Spiiplus Acspl Programmer S Guide
Spiiplus Acspl Programmer S Guide
P rogram m e r ’ s G ui de
Version NT 2.21
SPiiPlus ACSPL+
V e r s i o n N T 2 . 2 1 , 26 May 2013
COPYRIGHT
Copyright ® 1999 - 2013 ACS Motion Control Ltd.
Changes are periodically made to the information in this document. Changes are published as release
notes and are subsequently incorporated into updated revisions of this document.
No part of this document may be reproduced in any form without prior written permission from ACS
MotionControl.
TRADEMARKS
ACS MotionControl, PEG and SPii are trademarks of ACS MotionControl Ltd.
Visual Basic and Windows are trademarks of Microsoft Corporation.
Any other companies and product names mentioned herein may be the trademarks of their respective
owners.
NOTICE
The information in this document is deemed to be correct at the time of publishing. ACS MotionControl
reserves the right to change specifications without notice. ACS MotionControl is not responsible for
incidental, consequential, or special damages of any kind in connection with using this document.
Page Change
191 Maximum index/mark detection frequencies added.
202 Chapter 8.2 updated for UDMnt-x-A/B/C.
229 Chapter 8.4 updated.
Text Formats
Several text formats and fonts, illustrated in Table 1, are used in the text to convey information
about the text.
Command Formats
Table 2 provides the symbols employed in sample ACSPL+ commands. The general format is:
COMMAND {+f | -f} arguments . . . [options]
Flagged Text
The following symbols are used in flagging text:
Note
Notes include additional information or programming tips.
Caution
A Caution describes a condition that may result in damage to
equipment.
Warning
A Warning describes a condition that may result in serious bodily
injury or death.
Advanced
Indicates a topic for advanced users.
Model
Highlights a specification, procedure, condition, or statement that
depends on the product model.
Related Documents
The following documents provide additional details relevant to this guide:
array A standard variable or user variable that contains more than one value (element), as
opposed to a SCALAR. All values in an array belong to the same type, either
integer or real.
An array can be one-dimensional (vector) or two-dimensional (matrix).
autoroutine A subroutine in an ACSPL+ program activated automatically once a specific
condition is satisfied. The user specifies the activation condition and the action
executed in autoroutine. A number of autoroutines can be defined in a user
application.
axis An abstraction of the controlled motor.
Within the controller an axis is represented by a set of standard variables specifying
axis position, velocity, etc. One or more axes serve as an environment for motion.
The connection between the controller axes and the physical motor may range from
a simple one-to-one correspondence (default), to sophisticated formulae that
calculate the motor position using several controller axes.
axis group A set of axes that act as a coordinated unit. An axis group provides an environment
for multi-axis motion.
The controller creates and destroys axis groups automatically as required by the
executed motion. However, the user can create a permanent axis group that cannot
be destroyed automatically.
buffer A container for an ACSPL+ program.
There are up to 32 program buffers (numbered 0-31) for storing motion control
programs plus one buffer (the D-Buffer) for storing definitions of axis names and
global variables. The programs stored in the different buffers can be executed
concurrently.
closed loop An element of servo control that causes the specific parameter (feedback) to follow
the desired value (reference). For servo motors the controller provides position,
velocity and, sometimes, current closed loop.
Within the controller all closed loops are digital. The servo processor assigned to
the axis provides all necessary calculations.
configuration Mode of application protection where application and critical data can be modified
mode by user. Opposite of protected mode.
configuration A subset of standard variables that tailor the controller to a specific controlled plant.
variable The user typically defines these variables when building an application, and
thereafter does not change them. The values of the configuration variables are a part
of the application. As a rest of the application the values can be stored in the
nonvolatile memory. The controller automatically retrieves the values from the
nonvolatile memory on power-up.
controlled plant An object of the control that includes the following components:
Mechanical part
Motors
Feedback sensors
Additional sensors and actuators connected to the controller's digital or analog
inputs/outputs
controller One of the SPiiPlus NT line of compatible controllers. The models in the line differ
by packaging characteristics, available communication channels, number of
controlled axes, and internal resources. All models share the same basic
architecture and programming language.
Information in this guide applies to all SPiiPlus NT controllers.
controller cycle A primary period within the controller time framework. The controller aligns all its
operations to this period.
Depending on the product, the controller cycle can be set to 0.5 or 1.0 ms.
data collection The process of sampling the values of specified variables and storing them in a
specified array.
DHCP Dynamic Host Configuration Protocol - a protocol used by networked devices
(clients) to obtain various parameters necessary for the clients to operate in an
Internet Protocol (IP) network.
digital inputs/ Digital input accepts binary signal from an external source such as a switch or a
outputs relay. Digital output provides binary signal to an external acceptor such as an LED
or actuator. An ACSPL+ command can access the digital inputs/outputs through
the built-in IN/OUT variables.
DRA Disturbance Rejection Algorithm - an ACS proprietary algorithm used to
improve the disturbance rejection response of the servo, and helps to minimize the
position error during the settling phase as well as shorten the settling time.
factory default Set of controller configuration variables, SP programs and SP data written to the
controller nonvolatile memory as a part of the firmware. The user application can
replace one or more parts of the factory default. However, the controller can be
returned to factory default at any time by using the #RESET command.
fault An abnormal situation detected by the controller. The controller detects the faults
by examining the fault conditions as a part of safety control process. The fault
conditions include verification of the safety inputs as well as internal integrity.
firmware A set of files factory-written in the nonvolatile memory. The firmware includes the
MPU program, the default SP programs, and the default values of the configuration
variables. The user cannot modify the firmware; however, using SPiiPlus MMI
Application Studio the user can upgrade the firmware version.
If an application includes the values of the configuration variables, the controller
on the power-up retrieves the application instead of the factory defaults. The user
can delete the application at any time and to return to the factory defaults by using
the #RESET command.
global variables Variables that are common for all buffers.
A variable can have either global or local scope. All ACSPL+ variables have global
scope. A user variable’s scope is specified in the variable declaration. Global
variables are stored in the D-Buffer.
hardware The physical components of the SPiiPlus Motion Controller. The principal
hardware components include the MPU the Servo Processor, and the nonvolatile
memory.
host The user-supplied computer that communicates with the controller.
host-based A program written in C, C++ or any other programming language that runs on the
program host computer and communicates with the controller.
HSSI High-Speed Synchronous Serial Interface – One of the standard features in the
SPiiPlus controllers. HSSI provides an extension of the controller digital
inputs/outputs (for HSSI details see HSSI Modules Hardware Guide).
immediate A mode of command execution, when a command received via any communication
execution channel is not stored in a buffer but is executed by the controller immediately.
An Immediate command is always executed immediately. An ACSPL+ command
can either be executed immediately or stored in a buffer.
index 1. An input signal from the encoder or similar sensor that defines an absolute
origin of the motor. The signal cause latching of the current encoder position.
2. A syntax element of the ACSPL+ language that provides access to a specific
element of array.
leading axis The first specified axis in an axis group. The ACSPL+ variables, including the
variables’ parameters, tuning adjustments, and drive amplification, related to the
leading axis define motion for the entire group. The same variables of other axes in
the group have no effect on the group motion.
local variables Variables that are accessible only within the buffer that they are declared.
A variable can have either global or local scope. All ACSPL+ built-in variables
have global scope. A scope of user variable is assigned in the variable declaration.
mark A dedicated controller input signal that latches the current encoder position (saves
the position to a register). The register value is assigned to the ACSPL+ MARK
variable. A similar mechanism supports secondary encoders, with the input signal
called MARK2 and the value assigned to the M2ARK variable.
master-slave Motion that evolves according to some external or internal signal, as opposed to the
motion time-based motion that evolves as a function of the time.
In a simple case, an axis involved in a master-slave motion can reproduce the
motion of another axis.
matrix A two-dimensional array.
motion Process in the controller that results in a change in internal variables of the
controller, and can result in physical effects such as motor movement.
motion profile Diagram of position or velocity against the time in a time-based motion. The
controller provides a third-order motion profile using the velocity, acceleration,
deceleration and jerk supplied by the ACSPL+ variables.
motor The part of the controlled plant that performs physical movement on one axis.
MPU Main Processing Unit – The hardware component that executes the MPU
program.
MPU program The principal part of the firmware. It implements most of the controller functions,
and is stored in the nonvolatile (flash) memory. The controller automatically
retrieves the MPU program on the power-up. It cannot be modified by the user.
nonvolatile A type of memory that retains the values when the power is off. Referred to as the
memory flash memory.
PEG Position Event Generator – A SPiiPlus hardware-supported feature that enables
creating events based on exact position.
protected mode Mode of application protection where application and critical data are protected
from user intervention. Opposite of configuration mode.
PTP Point-to-Point
read-only An ACSPL+ variable that can be read from the controller but cannot be assigned.
variable
safety control The function of the controller that ensures safe operation of the system. Consists of
the verification of numerous fault conditions that the controller executes each
controller cycle irrespective of any other activity. Once a fault condition is satisfied,
the controller raises the corresponding fault.
safety inputs Digital inputs that the controller examines in the process of safety control.
scalar An ACSPL+ variable or user variable that contains one value, as opposed to an
array.
servo tick The period of SP program execution. This defines the sampling rate implemented
in the servo processor for digital servo control and fine interpolation.
settling time The time required for a motor to reside within a target envelope around the target
point before the controller raises the in-position bit in the ACSPL+ MST variable.
simulator An integrated part of each SPiiPlus tool that emulates the controller operations
without producing actual movement.
The Simulator is useful while developing the user application, for learning
ACSPL+ and for demonstration purposes.
SPii Servo Processor 2nd Generation
SPiiPlus NT Family of NT controller products built around the SPii.
Terminal A Terminal command is executed immediately and is not stored in a buffer. The
command command is entered via the SPiiPlus MMI Application Studio Communication
Terminal and can be sent to the controller through any communication channel. For
Terminal command details see the SPiiPlus Command & Variable Reference
Guide, and SPiiPlus MMI Application Studio User Guide.
time-based Motion that evolves as a function of time, as opposed to master-slave motion. The
motion characteristic feature of a time-based motion is a motion profile that shows the
motion progress against the time.
tools A set of Windows applications provided with the controller to aid the user in
developing and implementing an application. Each tool communicates with the
controller in order to perform various functions. Each tool includes a controller
simulator, which enables the tool to be used without requiring a physical
connection to the controller.
user variable User defined variable as opposed to ACSPL+ variables.
vector A one-dimensional array.
Table of Contents
Conventions Used in this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Text Formats iv
Command Formats iv
Flagged Text v
Related Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
About this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Terms and Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 About ACS Motion Control Motion Controllers . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 ACS Motion Control Company Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 ACS Motion Control NT Product Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 ACSPL+ Programming Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 SPiiPlus Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 Hardware Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Controller Cycle and Servo Tick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.3 Realtime and Background Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 User Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1 Firmware, User Application and Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.2 User Application Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.3 User Applications Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.4 SPiiPlus MMI Application Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2.5 File Extensions Used in SPiiPlus MMI Application Studio . . . . . . . . . . . . . 10
2.3 Programming Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.1 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.2 Program Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.3 Declaration Buffer (D-Buffer) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.3.1 Defining Global Objects in D-Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.3.2 D-Buffer Default Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.4 Command Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.4.1 Terminal Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.4.2 ACSPL+ Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.5 ACSPL+ Standard Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.6 User-Defined Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.7 Nonvolatile Memory and Power Up Process . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4 Executing ACSPL+ Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.1 Program Buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.2 Execution of a Single Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4.3 Concurrent Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4.4 Immediate Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4.5 Immediate Execution vs. Stored Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4.6 Autoroutine Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.7 Synchronization and Mutual Exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.7.1 Mutual Exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.7.2 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
List of Figures
Figure 1 SPiiPlus Controller Hardware Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 2 Multiple SPs Connected via EtherCAT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 3 The Internal Structure of the Controller Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 4 User Application Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 5 SPiiPlus MMI Application Studio Main Screen . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 6 Communication Terminal Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 7 GRTIME Behavior in PTP or TRACK Motion . . . . . . . . . . . . . . . . . . . . . . . . 78
Figure 8 Corner Processing - Exact Path Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Figure 9 Third-Order Velocity Profile. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Figure 10 Spline Definition Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Figure 11 Two-Dimensional Spline Definition Range . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Figure 12 5-Point Catmull-Rom Spline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Figure 13 B-Spline - Approximation of Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Figure 14 Catmull-Ron Spline Beyond the Definition Range . . . . . . . . . . . . . . . . . . . . . 120
Figure 15 B-Spline Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Figure 16 The Use of Limit Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Figure 17 Use of Variables in a Typical Motion Profile . . . . . . . . . . . . . . . . . . . . . . . . . 166
Figure 18 32-bit Error Data Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Figure 19 Fault Examination Flow Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Figure 20 SPiiPlus-Plant Connections and Related Parameters . . . . . . . . . . . . . . . . . . . 186
Figure 21 Simultaneous Connection for Remote Support . . . . . . . . . . . . . . . . . . . . . . . . 236
Figure 22 UMD Log Settings - Dump on Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Figure 23 UMD Log Settings - Continuous. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Figure 24 Data Entry Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Figure 25 Screen at the Conclusion of Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Figure 26 Window Accessed by Download. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Figure 27 Insensitivity Curve Illustration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Figure 28 Insensitivity Curve without Robust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Figure 29 Example 1 of Using DRA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Figure 30 Example 2 of using DRA (zoomed) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Figure 31 Example of Velocity Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Figure 32 Bi-Quad Configured as a Notch Filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Figure 33 Bi-Quad Configured as a 2nd Order Lead Filter . . . . . . . . . . . . . . . . . . . . . . . 275
Figure 34 Bi-Quad Configured as a 2nd Order Lag Filter. . . . . . . . . . . . . . . . . . . . . . . . 276
Figure 35 Bi-Quad Configured as a 2nd Order Low Pass Filter . . . . . . . . . . . . . . . . . . . 276
List of Tables
Table 1 Text Format Conventions................................................................................... iv
Table 2 ACSPL+ Command Syntax Symbols ................................................................ iv
Table 3 Related Documentation...................................................................................... vi
Table 4 SPiiPlus MMI Application Studio Extensions.................................................. 10
Table 5 Index Formats.................................................................................................... 33
Table 6 Mathematical Operators .................................................................................... 39
Table 7 Motor Modes................................................................................................... 127
Table 8 Types of Malfunctions .................................................................................... 139
Table 9 Faults and the Controller's Default Response ................................................. 142
Table 10 Safety Inputs.................................................................................................... 146
Table 11 Safety-Related Variables................................................................................. 146
Table 12 Typical Times to Load PEG Engines.............................................................. 205
Table 13 SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlusSAnt-x Mapping PEG Engines to
Encoders (Servo Processor 0).......................................................................... 206
Table 14 SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping PEG Engines to
Encoders (Servo Processor 1).......................................................................... 207
Table 15 CMnt-x-320/UDMpm-x-320/UDMpc-x-048/CMba-x-320/CMhp-x-320/
UDMba-x-320/UDMhp-x-320/UDMnt-x-A/B/C Mapping PEG Engines to
Encoders (Servo Processor 0).......................................................................... 207
Table 16 UDMlc-x-048/UDIlt-x/UDIhp-x Mapping PEG Engines to Encoders (Servo
Processor 0) ..................................................................................................... 208
Table 17 SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x General Outputs Assignment for
Use as PEG Pulse Outputs (Servo Processor 0) .............................................. 209
Table 18 SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x General Outputs Assignment for
Use as PEG Pulse Outputs (Servo Processor 1) .............................................. 209
Table 19 General CMnt-x-320/UDMpm-x-320 Outputs Assignment for Use as PEG Pulse
Outputs (Servo Processor 0) ............................................................................ 210
Table 20 UDMnt-x-A/B/C General Purpose Outputs Assignment for Use as PEG Pulse
Outputs (Servo Processor 0) ............................................................................ 210
Table 21 SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0) ............................................................. 212
Table 22 SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x Mapping of Engine Outputs to
Physical Outputs (Servo Processor 1) ............................................................. 212
Table 23 CMnt-x-320/UDMpm-x-320/UDMpc-x-048 Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0) ............................................................. 212
Table 24 CMnt-x-320/UDMpm-x-320/UDMpc-x-048 Mapping of Engine Outputs to
Physical Outputs (Servo Processor 0) ............................................................. 213
Table 25 CMba-x-320/CMhp-x-320/UDMba-x-320/UDMhp-x-320 Mapping of Engine
Outputs to Physical Outputs (Servo Processor 0)............................................ 213
Table 26 CMba-x-320/CMhp-x-320/UDMba-x-320/UDMhp-x-320 Mapping of Engine
Outputs to Physical Outputs (Servo Processor 0)............................................ 214
Table 27 UDMnt-x-A/B/C Mapping of Engine Outputs to Physical Outputs (Servo
Processor 0) ..................................................................................................... 214
Table 28 PEG State Output Signals Configuration........................................................ 220
Table 29 Mark-1 Inputs to Encoders Mapping for SPiiPlusNT/DC-LT/HP/LD-x /SPiiPlus
1 Introduction
This guide provides a general overview for programming the SPiiPlus™ motion controller
products using the ACSPL+ programming language.
This guide applies to the SPiiPlus NT motion control product lines a brief description of which
is given in Section 1.1.2 - ACS Motion Control NT Product Lines.
Note
The term “controller” is used in this guide whenever information applies for
both controllers and control modules. If information applies to only one of
these product groups, the group is stated explicitly.
2 SPiiPlus Architecture
This chapter provides an overview the SPiiPlus architecture.
The SP executes the realtime tasks, such as implementation of the realtime control algorithms.
Each SP controls four axes. The SP includes all the necessary peripherals that are needed for a
high performance axis control.
A single MPU module can manage several units over the EtherCAT bus thus expanding the
number of controlled axes as shown in Figure 2:
Note
The part of the system that is connected to the rest of the system via the
EtherCAT bus is called a unit.
2.1.1 Firmware
The firmware consists of a set of files factory-written in the flash memory.
You cannot erase or modify the firmware; however, you are able to update the firmware version
with a special tool that is part of the SPiiPlus MMI that is supplied with the controller.
The firmware files include the following:
MPU program.
Default values of the controller’s configuration variables.
The exact time of the realtime and background tasks in each controller cycle depends on many
factors and cannot be precisely specified. The following paragraphs explain different situations
in controller cycle utilization.
If the background task execution does not finish in one controller cycle, the background
execution is interrupted and continues after execution of the realtime tasks during the next
cycle. Therefore, background tasks may overlap into the next MPU interrupt without causing a
problem. However, overflow of realtime tasks into the next MPU interrupt is abnormal, and
may cause problems with program execution. When this occurs, the controller latches the Time
Overuse fault. This fault has no default response in the controller, but your application can
monitor the fault and define a proper response.
Note
You can monitor if the usage of the controller cycle is close to critical. The
SPiiPlus MMI Application Studio Communication Terminal command: #U
when entered, reports the usage as a ratio of realtime tasks execution time
and the controller cycle. A maximum value of 90% is considered dangerous.
If the usage limit is reached, you have to modify your application.
The program can provide front-end user interfaces, motion sequencing, high-level
decision-making and other application specific functions. This part of user application can
be absent if the controller works stand-alone without connection to the host.
The design of host-based programs is not the primary subject of this guide. For
Windows programming, refer to the SPiiPlus C Library Reference Guide.
ACSPL+ program:
A sequence of ACSPL+ commands can be downloaded to the controller as an ACSPL+
program. There are 10 buffers for ACSPL+ programs. An ACSPL+ program is executed
inside the controller with strict timing and with no communication delay.
ACSPL+ programs are almost always present in user applications. Occasionally,
the ACSPL+ programs are absent and the host commands all controller actions.
Configuration variables:
The firmware includes a set of predefined variables that can be used by ACSPL+ programs
and by Immediate commands. The configuration variables are included in this set. The
values of the configuration variables are defined by the user to tailor the controller
operation to a specific task and plant control. For example, ACC defines the acceleration
that is used for motion generation. The SAFINI variable defines the polarity of the input
safety signals.
The configuration variables must always be present in user applications.
SP programs:
The firmware includes SP (Servo Processor) real time control programs as a standard part
of the controller.
2.3.1 Commands
The controller supports a rich set of commands which are divided into two types of command
sets:
Terminal Commands
Terminal commands are those that are sent directly to the controller. They are entered
through the SPiiPlus MMI Application Studio Communication Terminal. The general
structure of the Communication Terminal windows is shown in Figure 6.
Note
Executing programs and autoroutines is not supported in D-Buffer.
Axes and global variables defined in D-Buffer are not required to be defined in other buffers
before use. However, such redefinition is not an error, given all attributes of the definitions are
identical.
The #SAVE and #SAVEPROG commands store the D-Buffer in the flash along with other
buffers.
Note
The values are also stored using the SPiiPlus MMI Application Studio
Program Manager Buffer Editor.
At start-up, the controller loads and compiles the D-Buffer before any other buffers.
Note
After any change in the D-Buffer, all other buffers should be recompiled.
The default contents of D-Buffer differ from other buffers. The other buffers are initially empty
by default; however, the D-Buffer contains a set of definitions that provides compatibility with
previous firmware versions. The default contents of the D-Buffer are:
axisdef X=0,Y=1,Z=2,T=3,A=4,B=5,C=6,D=7
axisdef x=0,y=1,z=2,t=3,a=4,b=5,c=6,d=7
global int
I(100),I0,I1,I2,I3,I4,I5,I6,I7,I8,I9,I90,I91,I92,I93,I94,I95,I96,I97,I98,I99
global real
V(100),V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V90,V91,V92,V93,V94,V95,V96,V97,V98,V99
This provides you with the means to define names for the axes in your system (axisdef). The
two 100 element arrays, one an integer and one a real, are, however, for internal use.
Processing time can also be affected by a high MPU usage. The realtime tasks always have the
greatest priority. If the usage (percentage of the realtime tasks in the controller cycle) reaches
90% or more, the response time of the controller deteriorates. If an application requires the
fastest response to Terminal commands, you must keep the usage below 50%.
Note
A user array can contain up to 100,000 elements.
A user-defined variable can be declared as local or global. Local variables are accessible only
within the buffer that the declaration resides in. Global variables are common to all buffers and
can be accessed from any buffer.
buffers both define a local variable with the same name, the variables are considered as two
different variables, each in its corresponding buffer.
A program in a buffer can be executed independently of any other program. The program
executed in a buffer does not affect the program executed in other buffers, unless you have
provided for synchronization through the global variables or common resources.
If a program in a buffer includes one or more autoroutines, the buffer manages the autoroutines
independently of other buffers. If an autoroutine condition is satisfied, only the program
executed in the enclosing buffer is interrupted. No other buffer is affected.
The time allotted for processing non-executable lines, e.g., comment, a new line, a label, etc.,
is controlled by the S_FLAGS.1 bit. If the bit is 0 (default), the non-executable line will be
skipped during execution. If the bit is 1, the line will be allotted a controller cycle. executed as
before taking a standard time for execution.
The bit affects the program compilation; therefore, if the bit is changed, the results will be
visible only after a program is recompiled.
will execute for 50 milliseconds instead of one controller cycle. The command:
TILL ^MST(0).#MOVE
If the controller prompt is: No program buffer is open for editing, and an ACSPL+
command, transmitted to the controller through any communication channel, is executed
immediately.
If the prompt contains a line number like 2:00001>, a program buffer is open for editing,
and an ACSPL+ command, transmitted to the controller through any communication
channel, is stored in the open buffer. ACSPL+ commands stored in a buffer constitute an
ACSPL+ program.
However, if a critical section is long, or combining it in one line is undesirable for any reason,
another solution must be found. The following construction implements a simple semaphore,
which is ON (one) while the program is inside the critical section, and is OFF (zero) otherwise.
global int Mutex Variable Mutex implements semaphore
. . . . . Any program actions
TILL ^Mutex; Mutex = 1 Enter critical section
. . . . . Critical section
Mutex = 0 Exit critical section
The Enter and Exit lines enclose the critical section. If the program contains several critical
sections, each section must be enclosed with the same Enter and Exit lines as shown in the
example above.
All programs that require mutual exclusion must include the same declaration of the Mutex
variable and the same embracing of each critical section.
This construction guarantees that only one of the concurrent programs may be inside a critical
section. If the second program tries to enter the critical section, the command till ^Mutex
delays the program execution until the first program zeroes Mutex on exit from critical section.
It should be noted that the solution is based on automatic one-line mutual exclusion. Therefore,
the two commands:
TILL ^Mutex; Mutex = 1
must be in one line. If they are placed in two sequential lines, they cannot provide mutual
exclusion.
2.4.7.2 Synchronization
Assume two programs that run mostly asynchronously must execute certain commands at the
same time. There is a point in each program that whichever program comes to the point first, it
must wait for the second program to come to its synchronization point. Then the next lines in
both programs will be executed in the next controller cycle.
The problem is solved by the following construction:
global int Sem The Sem variable implements a general semaphore
. . . . . Asynchronous part of the program
Sem = Sem+1; till Sem = 2; Sem = 0 Synchronization point
. . . . . The line will be executed synchronously
The same definition of the Sem variable and the same line of synchronization point must be in
the second program.
Whichever program comes to its synchronization point first, the command till Sem = 2 provides
waiting for the second program. The assignment Sem = 0 provides reuse of the construction if
necessary.
The solution can be also be extended to three or more concurrent programs.
3 ACSPL+ Overview
SPiiPlus enables running up to 32 separate ACSPL+ programs. The programs are stored in what
are referred to as “buffers”. The programs are entered via the SPiiPlus MMI Application Studio
Program Manager (see SPiiPlus MMI Application Studio User Guide for details).
This chapter provides a general overview of ACSPL+ programming.
For complete details of the ACSPL+ command set and variables refer to the SPiiPlus Command
& Variable Reference Guide.
The following is an example of a program line that contains two assignment commands:
V0 = V1 + 2*(V2 - V3); V4 = 0
White spaces (spaces and tabs) may be inserted arbitrarily inside or between commands.
However, white spaces must not be inserted within a keyword or variable name.
A command aggregate consists of several commands. It starts with a specific command and
terminates with the END command. For example, a loop structure starts with the loop command
followed by an arbitrary number of commands and terminates with the END command
signalling the completion of the loop. The commands of a structure may reside in one or more
program lines.
The following limitations are applied to the commands within the structure:
Commands and functions that may cause delay (WAIT, TILL, GETSP, WHILE, LOOP,
etc.) provide delays even if they are used within the BLOCK..END structure.
Some commands support the keyword: all, to designate all the axes supported by the controller.
The following examples are equivalent:
AXISDEF XY=0 !Define axis variable
ENABLE XY !Enable axis 0
PTP XY, 100, 200
3.1.7 Comments
A comment is text in a program that the controller stores along with the program but ignores
while executing the program. Comments are normally used to annotate a program.
A comment starts with an exclamation mark (!). An exclamation mark encountered in a line
designates all subsequent characters in the line as part of a comment. If the exclamation sign is
the first character in a line, the whole line is a comment.
! This entire line is a comment.
V0 = V1 !This comment starts from the exclamation mark.
3.2 Variables
Variables have the following attributes:
Name
Class (standard or user variable)
Scope (global or local)
Lifetime
Accessibility (read-write, read-only, protected)
Type (integer or real)
Size
Value
Note
The controller has a large set of ACSPL+ variables with predefined names.
You cannot change these names. These ACSPL+ variables can be used in
ACSPL+ commands without an explicit declaration.
This declaration may appear in several program buffers. However, in distinction to local
variables, all these declarations are considered to be the same variable.
Using a ACSPL+ variable in a program does not require explicit declaration of the variable.
However, a global user variable must be declared before it can be used in a program. Terminal
commands can use any global variable without explicit declaration.
is the same as
local real LocVar
A user global variable declared in one or more ACSPL+ programs is valid as long as at least
one of the programs that contains it is compiled. After compilation, the global variable is
assigned its value and is available for the #V (list of variables) Terminal command and queries.
A user global variable disappears when the last program that it is contained in returns to a non-
compiled state. The conditions when a program may return to non-compiled state are discussed
above.
A special case of user global variable is the persistent global variable. A global variable is
defined as persistent when the variable declaration is not a part of any program but is issued as
an immediate ACSPL+ command.
Assume, that you execute the following commands via the Communication Terminal
window:
global real PersistentVar !Declaration
?PersistentVar !Query
0 !Initial value
The controller immediately accepts the declaration and creates the persistent global variable:
PersistentVar. The variable is now valid and can be queried as illustrated by the query
command, ?PersistentVar, that follows.
The lifetime of a persistent global variable is not connected with any program. A persistent
variable survives any change in the program buffers and may be erased only by the explicit
#VGV (Clear Global Variables) Terminal command.
Wizard of the SPiiPlus MMI Application Studio (see the SPiiPlus MMI Application Studio
User Guide).
Note
The maximum size of a user array is 100,000 elements.
A typical use of an array requires access to a specific element of the array. To specify an
element of an array the array name must be followed by index specification. For example:
int Ar1(100),Ar2(3)(100) Declare local integer Ar1 as a vector of size 100 and local
integer Ar2 as a matrix of size 3x100
Ar1(4) = 3000 Assign 3000 to element 4of Ar1
Ar2(0)(99) = 20 Assign 20 to the element of Ar2(0,99)
DISP Ar2(0)(99) Display the element of Ar2(0,99)
Indexing of arrays starts from zero. In the example above the first element of Ar1 has index 0,
the last element has index 99.
For information on saving user arrays in the nonvolatile memory, see Section 2.3.7 -
Nonvolatile Memory and Power Up Process.
variable FPOS reads a feedback position of the corresponding motor. FPOS(0) provides the
position of the 0 motor, FPOS(1) provides the position of 1 motor, and so on.
Other ACSPL+ variables are related to the program buffers and therefore are sized according
to the number of buffers. For example, each element of PRATE specifies a program rate of the
corresponding buffer.
and temporary variables. Postfix indexes allow using the elements as separate variables such as
V0, V22, I99.
Arrays IN and OUT (Digital Inputs and Digital Outputs) are also often used with postfix
indexing. The typical access to a digital input looks like:
IN0.4
where the first number after name IN is a postfix index and selects a group of 32 inputs. The
number after the period is a bit specifier used to select one of the 32 bits (in this case bit #4).
Note that explicit indexing can be either constant or expression, while postfix indexing is
always constant.
Postfix indexing and explicit indexing can be used interchangeably in one program. However,
it is recommended that you select one style and use it throughout the application. If an
application requires non-constant indexing of axis-related variables, neither axis-like or post-
fix indexing can be used.
Each controller axis has an index. The index is an integer number from 0 to
Number_Of_Axes-1.
Note
Number_Of_Axes is defined by the controller model and cannot be changed,
for example, if there are 3 supported axes in a specific controller
specification, 0 designates the first axis, 1 the next, and 2 the last.
The index of an axis is fixed, for example, index 2 always refers to a specific physical axis. For
example:
VEL(1) – stores the velocity of the axis designated as 1.
ACC(5) – stores the acceleration of the axis designated as 5.
defines the name X for axis 23, W12 for axis 9, and T9 for axis 0.
AXISDEF can be repeated many times as you like to define all required names; however, the
following restrictions apply:
Only one name can be defined for the same axis
The names must be unique, i.e., you cannot define two axes with the same name
The name must not conflict with any other name of variable, label, keyword, etc.
A compilation error occurs if one of the above restrictions is not satisfied.
Axis names must be defined either in D-Buffer - see Section 2.3.3 - Declaration Buffer (D-
Buffer), or in a program, where it is used. In any case, the axis definition has global scope;
therefore the definition of the same axis in a different program must be identical (similar rules
apply to global variables). Axis defined in D-Buffer can be used in any other buffer without re-
definition.
int AxisGroup(3)
AxisGroup(0)=1; AxisGroup(1)=12; AxisGroup(2)=15;
ENABLE AxisGroup
PTP AxisGroup,1000,1500,1200
…
HALT AxisGroup
DISABLE AxisGroup
Other formats of axis specification are also supported (actually, they are considered as special
forms of array specification):
1. Axis expression, like (0, 1, 2), (Ax1, Ax2, Ax3, Ax4).
2. The keyword: all that specifies all available axes.
Where:
1. The first argument of the DC command is required to be an array, in this case it is the user
array, Data, that is specified without indexes, as a whole.
2. The second argument is an expression that defines the number of samples to be collected,
in this case it is a simple expression: the constant 1000.
3. The third argument is an expression that defines the sampling period. The V0 variable is a
simple expression. Using a variable instead of an integer provides changing the sampling
period, based on V0, from one execution of this data collection to another.
4. The fourth argument must be a variable or an array element. The values of the variable (in
this case V0) will be collected in the array. The syntax of DC requires that the fourth
element be a variable or an array element. Neither a general expression nor an array
without indexes can be specified. An array without indexes neither can be specified.
FPOS(0) addresses element 0 of the array FPOS that corresponds to the 0 axis feedback
position.
Only global variables can be declared with a tag. The following conditions also apply:
The tag is not mandatory in the variable declaration. However, if the tag is not declared,
the variable cannot be accessed by tag.
The value of tag_number must be greater than 1000. Values below 1000 are reserved for
the standard ACSPL+ variables.
The tag_number value must be unique in the application.
If more than one variable_name is included, when the program is compiled, the controller
builds a sequence of tag numbers: the specified tag_number is attached to the first variable
in the list, tag_number+1 value is attached to the second variable, tag_number+2 to the
third, and so on.
Comments:
The GETVAR function reads the current value of the variable and returns it as a real value. The
SETVAR function assigns the specified value to the variable designated by tag_number.
Though the value argument and the return value are defined as real, the functions can be used
for integer variables as well. The controller implements all necessary transforms automatically.
The functions provide read/write access to all standard ACSPL+ variables and to those user-
defined variables declared with tag.
3.7 Expressions
3.7.1 General
An expression is a sequence of operators and operands that specify a calculation.
Expressions serve as building blocks for many ACSPL+ commands. For example, assignment
commands include expressions to the right of the equal sign:
V0 = V1 + 2*(V2 - V3)
When the controller executes a command that includes an expression, the expression is
calculated and the result is used as required by the command.
Complexity of expression ranges from the simplest expressions that include only one constant
or variable name, to extended formulae containing multiple operators and functions with
several levels of brackets. For example:
I99 = 5 5 is a simple expression
I98 = V0 V0 is a simple expression
I97 = ((I1-1)*sin(I2)+2)/5 Complex expression
If several operators appear on the same line or in a group, they have equal precedence.
According to the type of result, an expression is defined as integer, real or logical. The
controller provides automatic type conversion of the result so that expression type required does
not restrict expression use. For example:
V0 = 0.01 * V1
In this assignment command, the integer variable V0 is to the left of the equals sign, while a
real expression is to the right of the equal sign. The controller automatically uses rounding type
conversion of the result obtained on the right side, so that the real value can be converted to an
integer variable and stored.
The types of operands and operators used in the expression define the expression type. Each
operator has an associated rule that defines the type of result according to the types of operands.
The rules are summarized in the following tables.
Note
Integer (0,1) is specified for the operators that produce only two values: 0 or
1 (logical result).
3.7.4 Operands
An operator requires one or two operands.
An operator that requires one operand is called a unary operator. A unary operator is placed
before its operand.
An operator that requires two operands is called a binary operator. A binary operator is
placed between its operands.
Unary operators:
Operator Type of Operand
integer real
- (unary minus) integer real
~ (inversion) integer integer
^ (logical not) integer (0,1) integer (0,1)
Binary operators:
Operator Type of Operand
integer-integer integer-real real-integer real-real
+ (addition) integer real real real
- (subtraction) integer real real real
* (multiplication) integer real real real
/ (division) real real real real
& (and), | (or), ~ (xor) integer integer integer integer
Each operand can be either integer or real. If the operator requires, the controller automatically
converts the operand to the required type.
Operands can be one of the following:
Constant
A constant can consist of any integer or real number. Integer constants can be presented in
decimal, hexadecimal and binary notation. Real constants can include a decimal point
and/or exponent.
Symbolic constant
Symbolic constants are predefined in the controller. Each symbolic constant presents an
integer number.
Scalar variable name or Array name with indexing
A variable name is a name of any standard or user-defined variable. If a user-defined name
is used, it must be declared before being used in the program. If the variable presents an
array, the name must be fully indexed to specify one element of the array.
Function call or Expression
Any ACSPL+ function can be used in an expression. Using expression as an operand of
other expression provides unlimited variety of expressions. In many cases expression used
as operand must be enclosed in brackets. For example:
(V0+5)*7 Expression V0+5 is the left operand of multiplication
(V0+5)*(I88+3) Both operands of multiplication are expressions
V1*3 + I2*6 Operands of addition are expressions V1*3 and I2*6
The following sections provide further elaborations on the operands and operators.
Because they always produce an integer result, compare operators can be used in arithmetical
calculations, for example:
V1 = (V0 = 5) * V4
The following example illustrates the AND operator. Both operands and the result are
considered as sets of 32-bits.
First 00010001000000000000000000011010
operand
Second 00111100000111111111000001111100
operand
Result 00010000000000000000000000011000
If both operands are logical, i.e., have only values of 0 or 1, the result is also logical. In this case
the operators can be treated as logical AND, OR and XOR. For example, the following
condition:
(V0 = 5) & (I30 = 0)
~ (inversion) – Provides bitwise inversion of its operand. If the operand is real, the
controller provides automatic conversion to integer before the
operation. The result is always an integer.
^ (logical not) – Accepts either an integer or real operand and calculates an integer
result. The result is 1 if the operand equals to 0, and is 0 if the operand
is non-zero.
The following two examples illustrate the difference between the ~ and ^ operations:
X 00111100000111111111000001111100
~X 11000011111000000000111110000011
^X 00000000000000000000000000000000
X 00000000000000000000000000000000
~X 11111111111111111111111111111111
^X 00000000000000000000000000000001
Note
Inversion is a bitwise operator, while the logical not applies to the entire
value.
provides waiting for the end of the 0 axis motion. The symbolic constant #MOVE provides
selection of bit 5 of the MST (Motor State) variable. The fifth bit of MST reflects the state of
the motion: it is 1 while the axis is in motion, and is 0 while the axis is idle.
assigns value 65 (or 0x41, which is the numerical equivalent of A) to the variable: Char.
is a legal command; however, when the command executes, if the controller is in the Protected
mode, the assignment fails and produces a run-time error.
If the ACSPL+ variable is scalar, no indexing is required.
If a ACSPL+ variable is an array, explicit or implicit indexing is required. For indexing of
ACSPL+ variables see Section 3.4.3 - Explicit Indexing through Section 3.4.4 - Postfix
Indexing of Standard Arrays.
Examples:
VEL(0) = 1000 Assign 1000 to 0 axis default velocity - explicit indexing
VEL0 = 1000 The same as above - postfix indexing
Var1 = FPOS(0) Assign to user variable
Var2(0)(5) = 200 Assign to element of user array
OUT0.5 = 1 Assign to digital output 5
If the controller cycle is 1 millisecond and PRATE is 1, the program displays a list of numbers
from 2 to 101. The first number, 2, corresponds to the standard execution time of two lines,
because the first time the additional delay provided by the WAIT command is zero. Each loop
executed adds one to the requested delay, therefore the displayed time grows correspondingly.
The bit: AST(0).#MOVE is raised as long as the 0 axis is involved in a motion. Inversion of
the bit (^AST(0).#MOVE), causing the bit to become non-zero, occurs when the motion ends
for any reason. Therefore the above TILL command provides a delay of execution of the next
command until the motion is over.
In the following example, the program starts a data collection and then a motion. The feedback
position is sampled with a period of 1 millisecond and stored in the data array. After the data
collection finishes, the data array contains a transient process of ptp motion. Synchronous data
collection used in the example displays its state in the AST(1).#DC bit which is raised as long
as the data collection is in progress. The collected data can be safely used only after the data
collection process has terminated. The TILL command below validates that both the motion
and the data collection are over:
global real Data(1000) Declare global real array Data of 1000 elements
DC/s 1, Data, 1000, 1, FPOS(1) Start data collection of FPOS(1) to array Data, 1000
samples, 1ms period
PTP 1, 2000 Start positioning of the 1 axis to absolute point 2000
TILL ^AST(1).#MOVE & ^AST(1).#DC Wait until both the 1 axis motion and the data
collection finish
The following example provides the 3 axis motion in negative direction until a general purpose
input becomes active and then terminates the motion:
JOG 3, - Start jog motion of the 3 axis in negative direction
TILL IN0.5 Wait until input 5 is activated
HALT 3 Terminate the 3 axis motion
In the following example a general purpose output must be activated 25 millisecond before the
motion end. The ACSPL+ GRTIME variable (for details on the GRTIME variable, see
Section 4.2.3 - The GRTIME Variable) contains the estimated time that remains to the
motion end.
PTP 0, 10000 Start positioning of the 0 axis to absolute point 10000
TILL GRTIME(0) <= 25; OUT0.4 = 1 Activate output 4 25 milliseconds before the motion
ends.
The output activation, OUT0.4 = 1, is placed in the same line as the TILL command in order
to avoid one controller cycle delay between program lines.
3.8.3 Autoroutines
The technique of autoroutines is similar to hardware interrupts. In distinction to routines that
must be explicitly executed (by way of the CALL command), the autoroutine is automatically
executed when a specific condition is satisfied. The routine interrupts the currently executing
program, executes the commands specified in the autoroutine body, and then returns control to
the interrupted program.
3.8.3.1 ON Command
Description:
The ON command flags the routine as an autoroutine and specifies the condition upon which
the execution of the routine is based.
Syntax:
ON expression
Comments:
The value of expression defines the condition. The condition is considered true if the
expression calculates to a non-zero result. A zero result corresponds to a false condition, and
the routine is not executed.
The controller never executes the ON command directly.
Note
If the program execution flow hits an ON command, the controller asserts a
run time error and aborts the program. Therefore you must either end the
program before the ON command, or use an unconditional GOTO
command to skip over the routine.
Instead of direct execution, the controller registers an autoroutine when the program containing
the routine is compiled. Then the controller calculates the expression each controller cycle in
parallel with executing ACSPL+ programs. If the expression calculates to a non-zero value, the
controller interrupts the ACSPL+ program being executed in the same buffer where the
autoroutine is located, and transfers the execution point to the autoroutine. If no ACSPL+
program is executed in the buffer, the controller does not interrupt any program and simply
starts the autoroutine execution.
The controller implements edge-detection in autoroutine condition verification. If a condition
becomes true, the controller activates the autoroutine only once. If the condition remains true
afterwards, the controller does not activate the autoroutine again. The condition must become
false and then become true again in order to activate the autoroutine again.
One or more autoroutines are specified in a buffer along with a regular program. In this
case the activation of the autoroutine interrupts the program execution. This approach is
the most suitable if the program and the autoroutine are closely related and must use the
same local variables. For example, the autoroutine processes the failure conditions for the
program, and must interrupt the program if a failure occurs.
3.8.3.4 Examples
The following fragment demonstrates a typical use of autoroutine for processing the controller
faults. The autoroutine provides an error message when the Drive Alarm of 0 axis occurs:
ON FAULT(0).#DRIVE Activate autoroutine when bit FAULT(0).#DRIVE changes
from 0 to 1
DISP "X Drive Alarm" Display an error message
RET End of autoroutine
The following autoroutine responds when either the Left Limit or Right Limit are activated:
ON FAULT(1).#LL | FAULT(1).#RL Activate autoroutine when the right or left limit bit is
activated on the 1 axis.
DISP "1 axis Limit Switch Display an error message
activated"
RET End of autoroutine
The following example assumes that an extra ventilator must be activated when the motor
overheat input signal is activated for the axis 2. The ventilator is controlled by the output bit:
OUT0.4. The ventilator must be disabled when the signal returns to inactive state.
ON FAULT(2).#HOT Activate autoroutine when bit FAULT(2).#HOT changes
from 0 to 1.
OUT0.4 = 1 Set output 4 to 1
RET End of autoroutine.
ON FAULT(2).#HOT Activate autoroutine when bit FAULT(2).#HOT changes
from 1 to 0.
OUT0.4 = 0 Set output 4 to 0
RET End of autoroutine.
All bits, not only faults, can be used in autoroutine conditions. Assuming that output OUT0.6
(of the 0 axis) is connected to a LED indicator, the following autoroutines signals the motion
state bit to activate the indicator, and deactivate it when the 0 axis is no longer in motion:
ON MST(0).#MOVE When the MST(0).#MOVE bit changes from 0 to 1
(signaling that the X axis is moving)
OUT0.6 = 1 Set output 6 to 1 (turns on the LED)
RET End of autoroutine.
ON ^MST(0).#MOVE When the MST(0).#MOVE bit changes from 1to 0
(signaling that the X axis is no longer moving)
The condition of an autoroutine can be any type of expression, not only bit verification. The
following autoroutine provides an alarm message if a fault occurs in the controller:
ON S_FAULT When a fault occurs
DISP "Something happened" Display an error message
RET End of autoroutine
The above autoroutine displays the alarm message only on the first fault. If one fault bit is
already raised, and another fault occurs, the second fault does not cause the alarm message.
The ACSPL+ MERR (motor error) array can be used for motor failure processing. While a
motor is enabled, the corresponding element of MERR is zero. If a motor is disabled, the
element stores the reason why the motor was disabled. Codes greater than or equal to 5010
correspond to fault conditions. The following autoroutine displays a message when the
controller disables the 0 axis due to any fault.
ON MERR(0) >= 5010 When the 0 axis motor is disabled
DISP "Motor 0 was disabled. Error Display a message stating that the motor was
code: ", MERR(0) disabled, and the error code of the fault
RET End of autoroutine
The ACSPL+ AERR array can be used to detect abnormal motion termination.
The ACSPL+ MERR and AERR variables expose only those faults that cause motor disable
or abnormal motion termination.
integer number. The specified or calculated buffer number must fall into the range 0 to 9. If the
number is out of range, error 3052 is generated.
The label_name argument is a label in the program (see Section 3.1.4 - Names: Variable and
Label). Execution starts from that label.
If the START command is executed from a program, the specified buffer_number must be
different from the buffer that contains the current program because a program cannot start itself.
It will be aborted, generating error 3044.
The START command executes successfully if the target buffer is loaded with a program,
compiled, but not running. Otherwise, the START command causes a run-time error and aborts
the current program.
The program activated by the START command executes concurrently with the program
containing the START command, and other active programs.
Examples:
The following fragment starts the program in buffer 2 from label PStart:
START 2, Pstart Start executing buffer #2 at the line labeled Pstart.
The following Terminal command displays change in buffer state after the start command was
executed:
?2 Querying status of buffer #2.
Buffer 2: 192 lines, running in line 153 Response to query.
After termination by the stop or stopall command, a program remains in the compiled state.
Therefore, if the program contains autoroutines, the autoroutines can be activated after the
program termination whenever its condition is satisfied.
Examples:
The following command terminates the current program:
STOP
The following command terminates the program only if the 0 axis is disabled:
IF ^MST(0).#ENABLED STOP; END
The following command executed in buffer 0 terminates the programs currently executed in all
buffers except buffer 0:
STOPALL
The following Terminal command displays change in buffer state after executing the stop
command:
?3 Querying status of buffer #3.
Buffer 3: 35 lines, compiled, not running Response to query.
The following Terminal command displays change in buffer state after executing the pause
command:
?0 Querying status of buffer #0.
Buffer 0: 97 lines, suspended in line 69 Response to query.
The following Terminal command displays change in buffer state after executing the resume
command:
?0 Querying status of buffer #0.
Buffer 0: 97 lines, running in line 83 Response to query.
If the MFLAGS.#ENMOD bit is 1, the ENTIME value defines the time of enable execution.
In executing the enable command, an ACSPL+ program always waits for ENTIME
milliseconds. If then the drive alarm fault is zero, the ENABLE command is considered
successful; otherwise the ENABLE command fails.
If the MFLAGS.#ENMOD bit is 0, the ENTIME value defines the maximum time allotted for
ENABLE execution. Executing ENABLE, an ACSPL+ program monitors the drive alarm
input signal. As soon as the drive alarm becomes inactive, the ENABLE command finishes
execution with success. If the drive alarm signal does not change to inactive state within
ENTIME milliseconds, the ENABLE command fails.
Examples:
ENABLE 0 Enable axis 0
ENABLE (2,3) Enable axes 2 and 3
DISABLE 2,5011 Disable axis 2, store 5011 as a disable reason. Code 5011
corresponds to left limit error, therefore the 2 axis motor will
be reported as disabled due to fault involving left limit.
DISABLE (2,3) Disable motors of axes 0 and 3
Syntax:
COMMUT axis, [excitation_current,] [settle_time,] [slope_time]
Arguments
The COMMUT command executes the autocommutation algorithm three times for verification
and elimination of unstable equilibrium. The approximate execution time of the command is
therefore 3*(settle_time + slope_time).
It should be noted that:
In air bearing systems a lower excitation_current may be required.
In high friction systems a higher excitation_current value is required.
The excitation_current should be the same as that which you determined in the initial
commutation adjustment process.
The settle_time parameter determines the settling time for the autocommutation process
initiated by the COMMUT command. The entire autocommutation process lasts
approximately three times longer, since the command executes the algorithm three times for
verification.
Note
In low-bandwidth systems (high inertia, etc.) a higher value may be
required.
The settling_time should be the same as that you have determined in the initial commutation
adjustment process.
If command KILL (0,1,4) is executed, each motor decelerates independently from its
instant velocity to zero using the constant decelerations KDEC(0), KDEC(1) and
KDEC(4).
In all cases bits AST.#MOVE and MST.#MOVE of axes 0,1, and 4 remain 1 as long as
any of the motor continues decelerating. Once all motors reach zero velocity, bits
AST(0).#MOVE, AST(1).#MOVE and AST(4).#MOVE drop to zero. Bit
MST(0).#MOVE drops to zero as soon as position error PE(0) remains less than
TARGRAD(0) for more than SETTLE(0) milliseconds. So do bits MST(1).#MOVE and
MST(4).#MOVE (for the 1 and 4 axes respectively).
KILL command with non-default connection
If a motor is in non-default connection but depends only on the corresponding axis the
effect of the KILL command is similar to the case of default connection. For example, if
the connection was specified as
CONNECT RPOS(0) = 0.5*APOS(0)*APOS(0)
DEPENDS 0,0
(in this case the DEPENDS command is not necessary), the KILL 0 command starts the
same kill process on the 0 axis motor and the halt process on the motion that involves the
0 axis. All above considerations about the idle motor, single-axis motion and multi-axis
motion remain the same.
The result is a little different if a motor depends on another axis or on several axes, for
example:
CONNECT RPOS(2) = APOS(0) + APOS(2) - APOS(4)
DEPENDS 2,(0,2,4)
(in this case the DEPENDS command is required). The difference is that the KILL 2
command applies the halt operation to all executed motions involving any of the axes 0, 2,
or 4. Correspondingly, bits AST(2).#MOVE and MST(2).#MOVE remain 1 as long as
any of these motions continues its termination process.
Note that a KILLALL command always terminates all executed motions and therefore
makes no difference between the default and non-default connection.
If one of the cleared faults is an encoder error, the command also resets the feedback position
to zero.
Although the SET command resembles the ASSIGNMENT command, execution of the set
command is different from ASSIGNMENT. The SET command induces a complex operation
in the controller instead of a simple assignment.
Regardless of the left-side variable, execution of the SET command starts with calculation of
expression. The result of the calculation provides the right-side value. Then the execution
depends on the variable specified on the left side.
The following are examples of the use of SET.
SET RPOS and SET FPOS
The SET command that contains RPOS or FPOS, shifts the origin of an axis. For example,
command
SET FPOS(0) = 0
places the origin of the 0 axis to the point where the motor is located this moment.
FPOS and RPOS provide a reference and a feedback value for a motor. If a control loop
works properly, FPOS follows RPOS with small or zero error.
If the error is zero, both SET FPOS and SET RPOS provide the same result: both FPOS
and RPOS become equal to the right-side value. This is not a simple assignment, and the
command adjusts the controller offsets so that the periodic calculation of FPOS and RPOS
will provide the required results.
If the error is non-zero, the result of SET FPOS and SET RPOS may differ slightly.
Consider the following example:
?RPOS(0), FPOS(0) Query RPOS and FPOS for the 0 axis
6000 The RPOS and FPOS differ by 2 counts due to, for
instance, the bias in the amplifier
6002
SET RPOS(0) = 0 Set RPOS to 0 for the 0 axis
?RPOS(0), FPOS(0) Query RPOS and FPOS for the 0 axis
0 RPOS is set to exact zero
Note that in both SET commands no physical motion occurs. The 0 axis remains in the
same position, only the internal offsets in the controller are adjusted to shift the origin as
required.
Note further that even if a motor is idle, several identical set FPOS commands may place
the origin at slightly different points due to the jitter in feedback.
If a motor is flagged by the Default Connection bit (MFLAGS.#DEFCON), the RPOS
and APOS variables are conjugate. Therefore, any command that changes RPOS, also
changes the corresponding APOS to the same value.
SET F2POS
The command SET F2POS shifts the origin of the secondary axis feedback. For example,
command
SET F2POS(0) = 0
places the origin of the 0 axis secondary feedback to the point where the motor is currently
located.
As a result of the command execution, F2POS becomes equal to the right-side value. This
is not a simple assignment, as the command adjusts the controller offsets so that the
periodic calculation of F2POS will provide the required result (the specified value in the
current point).
Note that even if a motor is idle, several identical SET F2POS commands may place the
origin in slightly different points due to the jitter in feedback.
SET APOS
If a motor is flagged by the Default Connection bit (MFLAGS.#DEFCON), variables
RPOS and APOS are conjugate, and always keep the same value. In this case, the set
APOS command is identical to the SET RPOS command for the same axis.
For non-default connection a motor and the corresponding axis are separated. Variables
RPOS and APOS may have different values. In this case, command set APOS shifts the
origin of the axis but has no effect on the origin of the motor. The controller adjusts offsets
so that the command causes no jerk in the motor.
Note
In the case of non-default connection the controller adjusts offsets only for
the motors that depend on the specified axis. Therefore, the depends
command is significant in a connection specification. If dependence is
specified incorrectly, one or more motors can jump once SET APOS=… is
executed.
Note
If the SPLIT command specifying an axis that is currently in motion is
executed within the buffer, the buffer execution is suspended until the motion
is completed. However, if the SPLIT command is sent from the host or as a
Terminal command, it returns error 3087: "Command cannot be executed
while the axis is in motion”.
The SPLITALL command breaks up all existing groups. An ACSPL+ program that starts in
an unknown environment (not just after power-up) can execute the SPLITALL command in
order to ensure that no axes are grouped.
4.1.7 GO Command
The GO command starts a motion that was created using the /w switch (see Section 4.7.2 -
SLAVE Command). A motion that has been created without this switch starts automatically
after creation and does not require the go command.
Syntax:
GO axes_specification
In simple cases axes_specification is a single axis like 0 or 13, or a string consisting of axis
enclosed in parentheses and separated by commas, for example: (0, 2, 13), or the keyword: all
(specifying all of the axes).
There following possibilities are available:
Starting single-axis motion
A GO command specifies one axis that is not included in any group. The command starts
the last created motion for the same axis. If the motion was not created, or has been started
before, the command has no effect. For example:
PTP/w 0, 1000 Create the motion, but do not start it
GO 0 Start the motion
If any of referenced axes are idle, the command does not affect this axis/group but does
affect all other specified axes/groups.
Note
The BREAK command is not supported in path or master-slave motion.
Caution
In multi-axis motion, smooth vector velocity profiles do not always
assure smooth motion of the coordinates. The user application must
provide nearly tangent motion trajectories in the junction point to
avoid jumps in coordinate velocity, which may cause damage to
equipment.
Although the IMM command resembles the ASSIGNMENT command, execution of the IMM
command differs from normal assignment to the same variables.
As in conventional assignment, execution of the IMM command starts from calculation of the
right-side expression. The calculated right-side value is assigned to the left-side variable.
Execution of flat assignment finishes at this point.
The difference between the conventional ASSIGNMENT and the IMM commands becomes
apparent when the command executes while a motion is in progress. The ASSIGNMENT
command does not affect the motion in progress or any motion that was already created and is
waiting in a motion queue. Only the motions created after the ASSIGNMENT command is
executed will use the motion parameters changed by the command. The IMM command, on the
other hand, not only changes the specified variable, but also affects the motion in progress and
all motions waiting in the corresponding motion queue. To change a motion on-the-fly, the
IMM command must change a variable of the axis that is a single axis of the motion or a leading
axis if the motion is in axis group.
If the axis is moving when the command is issued, the controller creates the motion and inserts
it into the axis motion queue. The motion waits in the queue until all motions before it finish,
and only then starts.
This command creates a motion of the 0 axis to the absolute target point of 1000. If the axis is
idle when the command is issued, the motion starts immediately.
If the e switch is specified, the controller will wait until the motion terminates before executing
the next command. The e switch is a convenient substitute for following the PTP command
with another command that waits for motion termination, for example, the command:
PTP/e 2,1000
is equivalent to:
PTP 2,1000
TILL ^AST(1).#MOVE
Appending the w switch to the PTP command prevents the motion from starting immediately
even if the axis is idle. The command:
PTP/w 0, 1000
creates a motion to the absolute target point 1000, but the motion will not start until the GO 0
command is issued.
In the two examples above the value 1000 is an absolute target point. To specify a relative value
you use the r switch:
PTP/r 0, 1000
This command creates a motion to a relative target point, which will be defined exactly only
when the motion starts. When the motion starts, the target point is calculated as the instant axis
position plus the specified value. For example, the following two commands
PTP 0, 1000
PTP/r 0, 1000
are equivalent to
PTP 0, 1000
PTP 0, 2000
In the previous examples the motion executed using the default velocity VEL(0) for the
specified axis. To override the default velocity you use the v switch, as shown in the following
example:
PTP/v 0, 1000, 15000
The motion created will ignore the default velocity VEL(0) and execute at a velocity of 15000.
The default value VEL(0) remains unchanged.
You can combine several switches in one command. For example, the command
PTP/rv 0, 1000, 15000
creates a temporary axis group that includes axes 0, 2 and 4 and executes motion in one group.
Temporary axis groups are automatically created and split-up by the controller. A group is
automatically split-up if the following motion does not address all the axes in the group.
The controller normally takes the motion parameter values from the leading axis. However this
can be overridden by using the /m switch, which causes the controller to calculate the maximum
allowed common motion velocity, acceleration, deceleration and jerk, for example:
PTP/m (0,1), 1000, 2000
The calculation examines the VEL, ACC, DEC, JERK parameters of the axes involved and
the projections of the motion vector to the axes.
Note
If the m switch is combined with the v switch, the m switch is ignored for the
velocity and the velocity specified in the command is used. However,
common acceleration, deceleration, and jerk are still calculated.
This command creates a multi-point motion of the 0 axis and specifies a dwell time of 1000
msec at each point. If dwell is not required, dwell_time may be omitted. The MPTP command
itself does not specify any point, so the created motion starts only after the first point is
specified. The points of motion are specified by the POINT or MPOINT commands that
follow the MPTP command.
The MPTP command creates the multipoint motion. However, the motion does not start until
a point is defined. After the first POINT command the motion starts if all involved axes are idle
(not involved in some previous motion), or waits until a motion that is in progress ends, and
then starts. The four POINT commands specify the following sequence:
The controller performs sequential positioning to each point. The ENDS command informs the
controller that no more points will be specified for the current motion. The motion cannot finish
until the ENDS command executes. If the ENDS command is omitted, the motion will stop at
the last point of the sequence and wait for the next point. No transition to the next motion in the
queue will occur until the ENDS command executes.
Normally, multi-point motion starts with the first POINT command, and the next POINT
command executes while the motion is already in progress. However, sometimes you may need
to delay starting the motion until all points are defined. You use the w switch to prevent the
motion from starting until a go command executes. The motion created by the command:
MPTP/w 0, 1000
Adding the r switch to the MPTP command causes all points to be treated as relative. The first
point is relative to the position when the motion starts, the second point is relative to the first,
and so on. The previous example, using the MPTP/r command, will look like this:
PTP (0,1), 0, 100 Create PTP motion to the first point (this serves
as the reference point).
MPTP/r (0,1) Create multipoint motion in group (0,1) with
no dwell time.
POINT (0,1), 100, 100 Add point.
POINT (0,1), 100, -100 Add point.
POINT (0,1), -100, -100 Add point.
ENDS (0,1) End the point sequence.
The MPTP command uses the default velocity VEL for positioning to each point. The v switch
allows using a specific velocity for each positioning. The desired velocity must be specified in
the POINT command after the point coordinates. The previous example is modified for using
different velocities:
MPTP/v (0,1) Create multipoint motion in group (0,1) with
no dwell time.
POINT (0,1), 0, 100, 30000 Move to first point at velocity 30000.
POINT (0,1), 100, 200, 10000 Move to second point at velocity 10000.
POINT (0,1), 200, 100, 5000 Move to third point at velocity 5000.
POINT (0,1), 100, 0, 10000 Move to fourth point at velocity 10000.
ENDS (0,1) End the point sequence.
Several suffixes can be appended to one command. For example, the command:
MPTP/rv 0, 1000
creates a multi-point motion with dwell time of 1000msec. The points will be specified by
relative coordinates, and velocity will be specified for each point.
Note
point_matrix must be a two-dimensional array, each column of which
containing the specification of one point. The matrix must contain at least
number_of_points columns. If the matrix contains more columns, the extra
columns are ignored.
If the corresponding motion command is MPOINT without the v switch or PATH without the
t switch (see Section 4.8 - PATH Command), a column of the matrix must contain the
coordinates of the point. Therefore, if the axis_designators includes M axes, the matrix must
contain exactly M rows.
If the corresponding motion command is MPTP/v, the matrix must contain M+1 rows. An
additional value in each column specifies the desired velocity for transition from the previous
to the current point. The velocity is specified in position units per second.
If the corresponding motion command is PATH/t, the matrix must contain M+1 rows. An
additional value in each column specifies the time interval between the previous and the current
point. The time is specified in milliseconds.
The following example illustrates how the MPOINT command can be used for adding points
on-the-fly. The example also shows a simple approach to synchronization between the host
computer that calculates the points and the controller that executes the motion.
The host computer calculates the desired points and transmits the coordinates via the Ethernet
link. The motion involves 6 axes. Therefore, each point specification contains 6 real numbers.
Because transmitting each point separately would be very ineffective in the Ethernet, the host
calculates the desired points in advance and transmits them in batches of 50 points. The
controller executes the motion. As soon as the controller is ready to accept the next batch of
points and the host is ready to send the batch, the next transmission occurs, and so on. The pace
of the host and the controller may be very different. However, the host is assumed fast enough
to calculate the next 50 points before the controller has moved through the previous 50 points.
The controller executes the following program:
real Points(50)(6) Declare an array of 50 points for each of six
axes. The host will write the coordinates to the
array.
int Sync Declare synchronization variable.
MPTP (0,1,2,4,5) Create multi-point motion for axes 0, 1, 2, 3, 4
and 5.
WHILE Sync >= 0 Continue until the host writes negative number
to Sync.
TILL Sync Wait until the points are received. Once the
host has filled the Points array, it writes the
Sync variable with a number of points written
to the Points array.
IF Sync > 0 Sync < 0 indicates that the host has finished the
point generation.
MPOINT (0,1,2,4,5), Points, Sync Add points from the Points matrix.
Sync = 0 The controller informs the host that the next
batch is expected. At this moment the motion
through the accepted points has not finished,
but the controller is ready to receive more
points.
END End if.
END End while.
ENDS (0,1,2,4,5) End mptp.
STOP End program.
while (Continue)
calculate N (<= 50) points in array HPoints;
N = -1
acsc_WriteReal(Com, NBuf, "Points", 0, N-1, 0, 6, HPoints, 0) ;
Synchronization between the host and the controller is provided by the Sync variable. When the
host has finished transmitting the next batch of points to the controller, it writes to Sync the
number of points in the batch. The controller waits for non-zero Sync and then adds the points
to the motion. When the controller has added the points, it writes zero to Sync, which signals
to the host to transmit the next batch of points.
When the host comes to the end, it writes -1 to Sync to indicate the end of the motion.
RVEL
Phase Phase Phase
1 2 3 4 5 6 7
Correct Value
Note
SLPMIN and SLPMAX variables can be changed only when the motor is
disabled.
This command creates a jog motion of the 0 axis in positive direction using the default velocity
VEL(0).
Motion direction may be specified in the command:
JOG 0, -
This command creates a jog motion of the 0 axis in negative direction using the default velocity
VEL(0).
The command:
JOG 0, +
The v switch allows a specific velocity to be used instead of the default velocity VEL. The
command:
JOG/v 0, 30000
ignores the default velocity and creates a jog motion with a velocity of 30000.
As with other types of motion, jog motion may be terminated by the HALT, KILL, or BREAK
commands. Unlike any other motion, jog motion also terminates when the next motion
command for the same axis executes. For example, the following program fragment:
JOG 0, +
WAIT 500
JOG 0, -
provides jogging in the positive direction for 500msec and then switches to the negative
direction. The controller automatically ensures a smooth transition from motion to motion.
Jogging can also occur in an axis group. For example, the following program fragment
JOG (0,1,4), -++
creates jogging in three axes: 0 in the negative direction, and 1 and 4 in the positive direction.
The motion uses the default velocity VEL(0) as a vector velocity for the three-axis motion.
If the axis is idle, the track motion is activated immediately. If the axis is moving, the controller
creates the motion and inserts it into the axis motion queue. The motion waits in the queue until
all previous motions in the queue are executed, and then starts.
When the track motion starts, the controller copies the current value of the reference position
(RPOS) element to target position (TPOS) element. For example, when the command is
executed, RPOS(0) is copied to TPOS(0). No change of RPOS and no physical motion occur
at this time.
Afterwards, the axis waits until the TPOS element is assigned a different new value. As soon
as the program executes:
TPOS(0) = NewTarget Assign a value to the TPOS element
the controller generates a PTP motion to the point designated by the value of the NewTarget
user variable. After the 0 axis reaches NewTarget, the axis waits for the next change of TPOS.
The next assignment to TPOS(0) automatically activates the next PTP motion and so on.
Therefore, track motion is executed as a sequence of PTP motions.
The motion state bits AST.#MOVE, AST.#ACC, MST.#MOVE, and MST.#ACC reflect the
state of each PTP motion in the track sequence exactly as they do for ptp motion. Between PTP
motions, while the axis waits for the next TPOS assignment, the motion bits are zero (with the
exception of the MST.#MOVE bit, which can be 1 if the position error exceeds the
TARGRAD limit).
The following ACSPL+ program fragment defines sequential positioning to points 1000, 2000,
10000, 11000:
TRACK 2 Create track motion of axis 2
TPOS(2) = 1000 Move to point 1000
TILL ^AST(2).#MOVE Wait till the motion ends
TPOS2 = 2000 Move to point 2000
TILL ^AST(2).#MOVE Wait till the motion ends
TPOS2 = 10000 Move to point 10000
TILL ^AST(2).#MOVE Wait till the motion ends
TPOS2 = 11000 Move to point 11000
TILL ^AST(2).#MOVE Wait till the motion ends
HALT 2 Terminate track motion
While the code with the PTP commands looks shorter and simpler, there are applications where
track motion is preferable to point-to-point motion.
Track motion is not terminated automatically. If TPOS is not changed, the axis track motion
remains at the last target point until TPOS is assigned a new value, and then the motion
continues.
Use a HALT or KILL command to terminate track motion.
Any subsequent motion command (except another TRACK command) for the same axis also
terminates the tracking motion. In this respect track motion is similar to the jog motion.
The motion profile while in Track mode, like in a standard PTP motion, is defined by the
ACSPL+ variables VEL, ACC, DEC and JERK. The track command accepts the values of
these variables at the beginning of each component PTP motion within the track motion.
Therefore, if an application assigns a new value to VEL, ACC, DEC or JERK, while track
mode is in effect, then the new value will be used the next time that the application initiates a
motion (by assigning a new value to TPOS).
The following ACSPL+ program fragment sets a specific velocity for each PTP motion:
TRACK 1 Create track motion of axis 1
VEL(1) = 20000 Set motion velocity 20000 units/sec
TPOS(1) = 1000 Move to point 1000
TILL ^AST(1).#MOVE Wait till the motion ends
VEL1 = 5000 Set motion velocity 5000 units/sec
TPOS1 = 2000 Move to point 2000
TILL ^AST(1).#MOVE Wait till the motion ends
VEL1 = 10000 Set motion velocity 10000 units/sec
TPOS1 = 110000 Move to point 11000
TILL ^AST(1).#MOVE Wait till the motion ends
HALT 1 Terminate tracking motion
In the example above the application updates TPOS only after the previous PTP motion ends.
In the following example the application updates TPOS while the motion is still in progress:
TRACK 0 Create tracking motion of X axis
TPOS(0) = 2000 Move to point 2000
TILL GPHASE(0) >= 6 Wait till the motion comes to phase 6
(deceleration to final point)
TPOS(0) = 2500 Correct the final point
TILL ^AST(0).#MOVE Wait till the motion ends
HALT 0 Terminate tracking motion
In this case, the controller does not execute two separate motions. As soon as TPOS is changed
to 2500 (before the controller reaches 2000), the controller changes the move on-the-fly to the
new target position of 2500. The on-the-fly change is done smoothly, similar to end-point
correction on-the-fly.
The same result is provided by the following fragment:
PTP 0, 2000 Move to point 2000
TILL GPHASE(0) >= 6 Wait till the motion comes to phase 6
(deceleration to final point)
BREAK 0 Terminate the current motion and provide
smooth transition to the next motion
PTP 0,2500 Move to point 2500
The TRACK command may also be used for programming multi-axes motion, for example, the
command
TRACK (0,2,3)
creates track motion of 0, 2 and 3 axes. The multi-axis track motion is executed as a sequence
of PTP motions. A new PTP motion starts each time when one or more elements of TPOS that
correspond to the involved axes are changed. Consider the following example:
TRACK 0;TRACK 2;TRACK 3 Create track motion of the 0, 2 and 3 axes
TPOS(0)=0; TPOS(2)=0; TPOS(3)=0 Move to point 0=0, 2=0, 3=0
TILL ^AST(0).#MOVE Wait till the motion ends
TPOS(2)=1000 Move to point 0=0, 2=1000, 3=0
TILL ^AST(0).#MOVE Wait until the 0 motion ends
TPOS(0)=100;TPOS(3)=200 Move to point 0=100, 2=1000, 3=200
HALT (0,2,3) Terminate track motion
In the following example TPOS is updated while the previous motion is still in progress:
TRACK (0,3) Create track motion of the 0 and 3 axes
TPOS(0)=2000; TPOS(2)=1000 Move to point 0=2000, 2=1000
TILL GPHASE(0) = 4 Wait until the motion reaches constant velocity
(phase 4)
TPOS(3)=0 Set a new final point 0=2000, 3=0
TILL ^AST(0).#MOVE Wait until the motion ends
HALT 0 Terminate tracking motion
In the above case, the controller does not execute two separate motions. As soon as TPOS is
updated, the controller changes on-the-fly from PTP motion towards 0=2000, 3=1000 to PTP
motion towards 0=2000, 3=1000. The transition from the first motion to the second is done
smoothly. While each PTP motion follows a straight trajectory, the transition between the
motion is not straight, as shown in the following diagram:
In both cases the second stage of the motion generation remains unchanged and depends only
on the specified segment sequence.
Segment commands specify a path on the plane, and the MPOS value of the leading axis
defines motion progress along the path.
Formulas that calculate the MPOS value must be defined before using the master command.
The e and t switches are relevant only for slaved motion and must be used with s or p suffix.
For discussion of slaved motion see Section 4.7.2 - SLAVE Command.
Segmented motion can be executed in an axis group with any number of controller axes.
The MSEG command specifies axis group and the initial starting point:
MSEG (0,1), 1000, 1000
This command creates a segmented motion of the X axis group and specifies the coordinates of
initial point on the plane. The MSEG command itself does not specify any segment, so the
created motion does not start immediately. A LINE or ARC command must follow the MSEG
command to specify the segment sequence.
Consider the following program fragment:
MSEG (0,1),1000,1000 Create segmented motion in group (0,1),
coordinates of the initial point are (1000,1000).
ARC1 (0,1), 1000,0,1000,-1000,- Add arc segment with center (1000,0), final point
(1000,-1000), clockwise rotation.
The MSEG command creates the segmented motion. The motion does not start, because no
segment is defined yet. After the first ARC1 command the motion starts if the axis group is idle
(not involved in some previous motion). If the group is not idle, motion will start when the
previous motion stops. The four segment commands specify the following path (where X is the
direction of the 0 axis and Y is the direction of the 1 axis):
Y
Start
(-1000,1000)
X
(-1000,1000)
(1000,-1000)
ARC1 and ARC2 differ only by the required arguments. ARC1 requires the coordinates of the
center point, final point, and the direction of rotation. ARC2 requires the coordinates of the
center point and the rotation angle (in radians). Each command produces the same result, so
selection of either ARC1 or ARC2 depends on the available data. If you know the coordinates
of the center point, coordinates of the final point and the direction of rotation, ARC1 is
preferable. If you know the coordinates of the center point and rotation angle, ARC2 is
preferable.
The rotation_direction argument can be:
+ (plus) – for counter clockwise
- (minus) – for clockwise rotation
The entire sequence of segmented motion must be terminated with an ENDS command. The
ENDS command informs the controller that no more segments will be specified for the
specified motion. The motion cannot finish until the ENDS command executes. If the ENDS
command is omitted, the motion will stop in the last point of the sequence and wait for the next
point. No transition to the next motion in the queue will occur until the ENDS command is
executed.
Segmented motion usually starts with the first segment command (LINE, ARC1, or ARC2).
The next segment command therefore executes while the motion is already in progress. This is
generally not a problem, because the program execution rate is higher than typical motions
time. However, sometimes you may need to delay starting the motion until all points are
defined. In this case you append the w switch to the command to prevent the motion from
starting until the GO command is issued. The motion, created by the command
MSEG/w (0,1),1000,1000
The MSEG command uses the default velocity VEL for each segment. The v switch overrides
the default velocity and allows you to define a specific velocity for each segment. The desired
velocity must be specified in the LINE, ARC1 and ARC2 segment commands after all other
arguments. If the velocity argument is omitted in a segment command, the velocity from the
previous segment is used. If the velocity argument is omitted in the first segment, the default
VEL is used. The previous example is modified for using individual velocities:
MSEG/v (0,1),1000,1000 Create segmented motion in group (0,1),
coordinates of the initial point are (1000,1000).
ARC1 (0,1), 1000,0,1000,-1000,- Add arc segment with center (1000,0), final
,30000 point (1000,-1000), clockwise rotation, vector
velocity 30000.
LINE (0,1),-1000,-1000 Add line segment with final point (-1000,-
1000). Vector velocity is not specified,
previous value 30000 will be used.
ARC2 (0,1),-1000,0,-3.141529,10000 Add arc segment with center (-1000,0),
rotation angle of -, vector velocity 10000.
LINE (0,1),1000,1000,5000 Add line segment with final point (1000,1000),
vector velocity 50000.
ENDS (0,1) End the segment sequence
Several suffixes can be attached to one command. For example, the command
MSEG/vw (0,1), 1000, 1000
creates a segmented motion with individual velocity for each segment. The motion does not
start until the GO (0,1) command is issued.
As mentioned above, all coordinates, specified in the segment commands, are absolute in the
working plane. Projection is a matrix that connects the plane coordinates and the axis values as
specified in the mseg command. If the axis group contains two axes, and no PROJECTION
command is specified, the controller provides a default projection that corresponds to a 2x2
matrix:
1 0
0 1
The matrix directly connects the first coordinate of the working plane to the first axis of the axis
group and the second coordinate to the second axis.
The matrix can also define rotation and scaling. The full transform also includes an implicit
offset. The controller calculates the offset automatically in such a way that the initial
coordinates specified in the mseg command match the desired axis values at the moment when
the motion starts. The offset provides the full path to be relative to the starting point.
If an axis group contains N axes, the controller extends the default matrix to N lines. The
additional lines are filled by zeros:
1 0
0 1
0 0
… …
0 0
The matrix connects only the first two axes to the plane coordinates. Therefore the segmented
motion will involve only the first two axes in the group.
If N = 1, the MSEG command applies to a single axis, and the matrix contains the first line only:
1 0
In this case the axis will follow the first coordinate of the working plane.
You can replace the default matrix with the PROJECTION command.
Example:
real M(3)(2) !Define Matrix
M(0)(0)=1;M(0)(1)=0
M(1)(0)=0;M(1)(1)=1
M(2)(0)=0;M(2)(1)=2.74 !Set the transformation
!matrix values.
VEL(0)=1000;ACC(0)=10000;DEC(0)=10000 !Axis motion parameters
ENABLE (0,4,5) !Required command.
GROUP (0,4,5) !Required command.
SET FPOS(0)=0;SET FPOS(4)=0;SET FPOS(5)=0 !Set axes’ FPOS=0
MSEG (0,4),0,0 !Define original plane.
PROJECTION (0,4,5),M !PROJECTION of the 0, 4 and 5
!axes by matrix M
ARC2 (0,4),750,0,6,24 !ARC2 performed on new plane.
ENDS (0,4) !Concludes MSEG.
STOP !End Program
If the group contains N axis, the matrix in the projection command must be of size Nx2.
The program executes the line command 2000 times. The line segments build up a curve close
to the Archimedean spiral:
Note
Cyclic segmented motion does not automatically finish. You must use one of
the commands HALT, KILL, or BREAK to stop cyclic motion.
ARC1 (0,1), 1000,0,1000,–1000,– ! Add arc segment with center (1000,0), and
! final point (1000,-1000), clockwise rotation
LINE (0,1),–1000,–1000 ! Add line segment with final point (-1000,- 1000)
The size of the velocity jump depends on vector velocity and geometry of the corner. For
example, for X axis:
Vx = Vcos1 - Vcos0
where:
V is the vector velocity
0 and 1 are the tangent vector angles before and after the corner ( = 1 - 0 is the corner
angle). The velocity jump is zero in two cases:
The vector velocity is zero in the corner
The corner angle is zero
However, in real life the velocity jump does not occur in zero time. The controller calculates
the required position in discrete time moments, with sampling period CTIME:
Change of axis velocity can be considered as an accelerated motion, with equivalent axis
acceleration: V/CTIME
The user specifies lower (or zero) velocity in the segment final point. The specification
defines velocity in one point, but doesn’t change required velocity for subsequent
segments.
The user specifies required velocity greater than axis velocity (VEL value) of one or more
involved axes. On some segments the required vector velocity can be achieved, on others
the axis velocity would be surpassed. The controller reveals such segments, and limits the
vector velocity accordingly.
The controller detects a corner while an exact-path option is selected. The controller uses
threshold angle and corner velocity values to define required velocity in the corner point.
The controller reveals an arc segment that requires centripetal acceleration greater than
axis acceleration (ACC value) of one or more involved axes. The controller reduces
velocity on this segment to comply with all axis acceleration values.
After all velocity restrictions are exposed, the controller builds a third-order velocity profile that
never exceeds the required velocity.
Note
Frequently, acceleration/deceleration intervals appear longer than the
related segment. When a CAD system calculates the motion segments, the
resulting motion often contains numerous small segments. In this case, the
acceleration/deceleration interval may span a number of segments. To
calculate proper velocity profile, the controller needs to analyze segments
well ahead of the current segment, reveal changes in required velocity in
advance, and then trace the segments back to find starting points of
deceleration in velocity profile.
mechanical jerks, but moves at a slower rate as long as starvation continues; once the host
begins supplying segments at sufficient rate, the controller returns to normal execution.
Model
When using one of the above products, the product should be configured such
that the controller time (CTIME) equals 1 millisecond and not more than 1
XSEG motion is to be executed simultaneously.
This approach is simpler in implementation and ensures more optimal trajectory passing time,
as starvation is avoided. However, the trajectory cannot be quickly changed on the fly as all
already added segments should be executed first.
If the segments are added from the host application, the application polls the bit and when it is
raised, the segment is added.
In order to avoid the starvation, the user application is able to configure when the #NEWSEGM
flag is raised by including the starvation_margin optional argument in the XSEG command.
4.6.7 XSEG...ENDS
A new ACSPL+ command block: XSEG...ENDS has been added to support Extended
Segmented Motion. XSEG...ENDS enables the user to incorporate the following into the
motion application:
Corner detection
Detection of segments, where required velocity violates axis velocity/acceleration limits
Velocity limitation at corners and problematic segments
Building a velocity profile using multi-segment look-ahead algorithm
The following commands are used within the block to define the segmented motion:
ARC1 - adds an arc segment to a segmented motion and specifies the coordinates of center
point, coordinates of the final point, and the direction of rotation
ARC2 - Adds an arc segment to a segmented motion and specifies the coordinates of center
point, rotation angle and direction.
LINE - Adds a linear segment to a segmented motion.
ENDS- terminates the motion sequence
XSEG updates the following motion-related parameters:
Motion and Axis Statuses: AST, MST
Vector velocity, acceleration and jerk: GVEL, GACC, GJERK
Axis velocity: GVEC
Note
The deceleration (DEC) parameter is not used by the XSEG command.
Syntax
XSEG [/switches] (axis_list), initial_position_axis1,initial_position_axis2
[,velocity][,end_velocity][,junction_velocity][,angle] [,starvation_margin
[,segments_buffer]]
Arguments
axis_list Single axis or axis group, valid numbers are: 0, 1, 2, ... up to the number of
axes in the system minus 1.
initial_position_axis1 Initial position of the first axis.
initial_position_axis2 Initial position of the second axis.
velocity [Optional, only used with /v switch]
Defines required velocity instead of default velocity (VEL). See Switches
for details.
end_velocity [Optional, only used with /f switch]
Defines required velocity at the end of each segment.
junction_velocity [Optional, only used with /j switch]
Defines required velocity at the junction.
angle [Optional, only used with /a switch]
The junction will be treated as a corner if actual junction angle is more than
defined.
starvation_margin [Optional] Starvation margin in milliseconds. The controller sets the
AST.#NEWSEGM bit starvation_margin millisecond before the
starvation condition occurs.
By default, if the argument is not specified, the starvation margin is 500
milliseconds.
segments_buffer [Optional] One-dimensional user defined real array. The controller uses this
array to store adding segments. By default, if the argument is not specified,
the controller allocates internal buffer for storing 50 segments only. The
argument allows the user application to reallocate the buffer for storing
larger number of segments. The larger number of segments may be required
if the application needs to add many very small segments in advanced.
Switches
The following optional /switches may be used singularly or in combination with the XSEG
command:
/w Do not start until the GO command.
If the switch is not specified, the motion starts immediately after the first motion segment
is defined.
/v Specify required velocity.
The switch requires additional parameter that specifies required velocity.
If the switch is not specified, the required velocity is derived from the leading axis
parameters.
/m Use maximum velocity under axis limits.
With this switch, no required velocity should be specified.
The required velocity is calculated for each segment individually on the base of segment
geometry and axis velocities (VEL values) of the involved axes.
/f Decelerate to the end of each segment.
The switch requires an additional parameter that specifies end velocity. The controller
decelerates to the specified velocity in the end of each segment. The specified value should
be less than the required velocity; otherwise the parameter is ignored.
If the switch is not specified, deceleration in each segment is not required. However, in
specific segments deceleration might occur due to corner processing or other velocity
control conditions.
/j Decelerate to corner.
The switch requires an additional parameter that specifies corner velocity. The controller
detects corner on the path and decelerates to the specified velocity before the corner. The
specified value should be less than the required velocity; otherwise the parameter is
ignored.
If switch j is not specified while switch a is specified, zero value of corner velocity is
assumed.
If switches j and a are not specified, the controller provides automatic calculation of the
corner processing (see Section 4.6.2).
/a Do not treat junction as a corner, if junction angle is less than or equal to the specified value
in radians.
The switch requires an additional parameter that specifies negligible angle in radians.
If switch a is not specified while switch j is specified, the controller accepts default value
of 0.01 radians, that is, about 0.57 degrees.
If switches j and a are not specified, the controller provides automatic calculation of the
corner processing (see Section 4.6.2).
Note
XSEG without suffixes does not require any additional parameters except
the initial point coordinates, for example, XSEG (0,1),0,0 creates
segmented motion for axes 0 and 1 with initial point (0,0) with required
velocity derived from the axis 0.
XSEG/vf (0,1),0,0,100,50 Segmented motion for axes 0 and 1 with initial point
(0,0) with required velocity 100 units/sec; at the end of
each segment, the motion should decelerate to 50
units/sec.
XSEG/vja (1,2),1000,1000, 100,20,0.05 Segmented motion for axes 1 and 2 with initial point
(1000,1000) and required velocity is 100 units/sec. If
the path contains a junction, and the junction angle is
more than 0.05 radians, the velocity decelerates to 20
unit/sec in the junction point.
4.6.8 ARC1
Description
ARC1 has been modified for incorporation in Extended Motion and in this form must be
initialized with XSEG...ENDS. Use ARC1 to specify the center point and final point
coordinates of an arc and the direction of rotation. Direction is designated by a plus sign (+) or
(–) for clockwise or counterclockwise rotation depending on the encoders’ connections.
Syntax
ARC1 [/switches] (axis_list), center_point_axis1,center_point_axis2,
destination_point_axis1,destination_point_axis2,direction,
[,velocity][,end_velocity][,values, variables[,index [,masks]]]
Arguments
axis_list Defines one or two axes, specified as axes numbers separated by comma or
as axes names separated by comma. The axes should only be those axes
specified in the corresponding XSEG command.
center_point_axis1 Center point position for the first axis
center_point_axis2 Center point position for the second axis
destination_point_axis1 Destination position of the first axis
destination_point_axis2 Destination position of the second axis
direction Direction is specified as + or -. It defines clockwise or counterclockwise
rotation depending on the encoder connection: “+” for motion in the
direction of increasing encoder counts, or “-” for motion in the direction
decreasing encoder counts.
velocity [Optional, only used with /v switch]
Defines required velocity for the current and for all subsequent segments.
See Switches explanation for details.
end_velocity [Optional, only used with /f switch]
Defines required velocity at the end of the current segment. See Switches
explanation for details.
values [Optional, only used with /o switch]
Defines the values to be written to variables array at the beginning of the
current segment execution. values is a one-dimensional user defined array
of integer or real type with maximum size of 10 elements .
variables [Optional, only used with /o switch]
Defines the user-defined array, which will be written with values data at the
beginning of the current segment execution. variables is a one-dimensional
user defined array of the same type and size as the values array.
index [Optional, only used with /o switch]
Defines the first element (starting from zero) of the variables array, to which
values data will be written. If argument is omitted, values data is written to
the variables array starting from the first element (index 0).
masks [Optional, only used if values and variables are integer]
Defines the masks that are applied to values before the values are written to
variables array at the beginning of the current segment execution. masks is
a one-dimensional user-defined array of integer type and the same size as
the values array. The masks are only applied for integer values:
Switches
The following optional /switches may be used singularly or in combination with the ARC1
command:
/v Specify required velocity.
The switch requires an additional parameter that specifies the required velocity. The switch
changes the required velocity for the current segment and for all subsequent segments.
If the switch is not specified, the required velocity does not change.
/f Decelerate to the end of segment.
The switch requires an additional parameter that specifies the end velocity. The controller
decelerates to the specified velocity at the end of segment. The specified value should be
less than the required velocity; otherwise the parameter is ignored. The switch affects only
one segment.
The switch also disables corner detection and processing at the end of segment.
If the switch is not specified, deceleration is not required. However, in special cases the
deceleration might occur due to corner processing or other velocity control conditions.
/o Synchronize user variables with segment execution. The switch requires additional two or
three parameters that specify values, user variable and mask. See details in Arguments for
explanation.
4.6.9 ARC2
Description
ARC2 has been modified for incorporation in Extended Motion and in this form must be
initialized with XSEG...ENDS. Use ARC2 to specify the center point and rotation angle in
radians of an arc segment. Designate direction by positive or negative rotation angle, depending
on the encoders’ connections.
Syntax
ARC2 [/switches] (axis_list), center_point_axis1,center_point_axis2, rotation_angle,
[,velocity][,end_velocity][,values, variables[,index[,masks]]]
Arguments
axis_list Defines one or two axes, specified as axes numbers separated by comma or
as axes names separated by comma. The axes should only be those axes
specified in the corresponding XSEG command.
center_point_axis1 Center point position for the first axis
center_point_axis2 Center point position for the second axis
rotation_angle Defines central angle of the arc, signed according to rotation direction: plus
for a counter-clock-wise arc, minus for a clock-wise arc.
velocity [Optional, only used with /v switch]
Defines required velocity for the current and for all subsequent segments.
See Switches explanation for details.
end_velocity [Optional, only used with /f switch]
Defines required velocity at the end of the current segment. See Switches
explanation for details.
Switches
The following optional /switches may be used singularly or in combination with the ARC2
command:
/v Specify required velocity.
The switch requires an additional parameter that specifies the required velocity. The switch
changes the required velocity for the current segment and for all subsequent segments.
If the switch is not specified, the required velocity does not change.
/f Decelerate to the end of segment.
The switch requires an additional parameter that specifies the end velocity. The controller
decelerates to the specified velocity at the end of segment. The specified value should be
less than the required velocity; otherwise the parameter is ignored. The switch affects only
one segment.
The switch also disables corner detection and processing at the end of segment.
If the switch is not specified, deceleration is not required. However, in special cases the
deceleration might occur due to corner processing or other velocity control conditions.
/o Synchronize user variables with segment execution. The switch requires additional two or
three parameters that specify values, user variable and mask. See details in Arguments for
explanation.
4.6.10 LINE
Description
LINE has been modified for incorporation in Extended Motion and in this form must be
initialized with XSEG...ENDS. Use LINE to add a linear segment that starts at the current
point and ends in the destination point to the motion path.
Syntax
LINE [/switches] (axis_list), destination_point_axis1[,destination_point_axis2]
[,velocity][,end_velocity][,values, variables[,index[,masks]]]
Arguments
axis_list Defines one or two axes, specified as axes numbers separated by comma or
as axes names separated by comma. The axes should only be those axes
specified in the corresponding XSEG command.
destination_point_axis1 Destination position of the first axis
destination_point_axis2 Destination position of the second axis
velocity [Optional, only used with /v switch]
Defines required velocity for the current and for all subsequent segments.
See Switches explanation for details.
end_velocity [Optional, only used with /f switch]
Defines required velocity at the end of the current segment. See Switches
explanation for details.
values [Optional, only used with /o switch]
Defines the values to be written to variables array at the beginning of the
current segment execution. values is a one-dimensional user defined array
of integer or real type with maximum size of 10 elements .
variables [Optional, only used with /o switch]
Defines the user-defined array, which will be written with values data at the
beginning of the current segment execution. variables is a one-dimensional
user defined array of the same type and size as the values array.
index [Optional, only used with /o switch]
Defines the first element (starting from zero) of the variables array, to which
values data will be written. If argument is omitted, values data is written to
the variables array starting from the first element (index 0).
masks [Optional, only used if values and variables are integer]
Defines the masks that are applied to values before the values are written to
variables array at the beginning of the current segment execution. masks is
a one-dimensional user-defined array of integer type and the same size as
the values array. The masks are only applied for integer values:
Switches
The following optional /switches may be used singularly or in combination with the LINE
command:
/v Specify required velocity.
The switch requires an additional parameter that specifies the required velocity. The switch
changes the required velocity for the current segment and for all subsequent segments.
If the switch is not specified, the required velocity does not change.
/f Decelerate to the end of segment.
The switch requires an additional parameter that specifies the end velocity. The controller
decelerates to the specified velocity at the end of segment. The specified value should be
less than the required velocity; otherwise the parameter is ignored. The switch affects only
one segment.
The switch also disables corner detection and processing at the end of segment.
If the switch is not specified, deceleration is not required. However, in special cases the
deceleration might occur due to corner processing or other velocity control conditions.
/o Synchronize user variables with segment execution. The switch requires additional two or
three parameters that specify values, user variable and mask. See details in Arguments for
explanation.
LINE/v (1,0), 1000, -1000, 500 Add line segment with end point (1000, -
1000) and segment velocity 500.
arc1/vf (0,1), 0, 0, 100, 100, +, 500, 100 Add arc segment with center (0,0), end point
(100,100), clockwise direction, segment
velocity 500 and end velocity 100
int Value(1) Add arc segment with center (0,0) and 180
int Mask(1) degree (π) angle. At the beginning of the
Value(0) = 1; Mask(0) = 5 segment execution, sets bit 0 and reset bit 2
ARC2/o (0,1), 0, 0, 3.141529, Value, OUT, 2, Mask of digital outputs OUT(2).
4.6.12 Example
The following is a simple program example employing Extended Segmented Motion:
ARC1 (0,1),1000,0,1000,–1000,– !Add arc segment with center (1000,0), final point (1000,
!1000), clockwise rotation
LINE (0,1),–1000,-1000 !Add line segment with final point ( 1000, 1000)
ARC2 (0,1),–1000,0,–3.141529 !Add arc segment with center ( 1000,0) and rotation
!angle of -
The XSEG command creates the segment motion. The motion does not start at this moment.
Actual motion starts once the previous motion ends and one or more segments are added. The
four segment commands specify the following path:
Note
The LINE command may specify one axis that actually moves in this
segment. Other axes specified in XSEG hold their positions while the linear
segment is in progress.
rotation (+ for counter-clockwise, – for clockwise rotation). The ARC2 command specifies the
coordinates of the center point and rotation angle (positive for counter clockwise, negative for
clockwise rotation). The ARC1 and ARC2 commands may produce the same result, so the user
may select the one that suits the available data. If the user knows the coordinates of the center
point, coordinates of the final point and the direction of rotation, ARC1 is preferable. If the user
knows the coordinates of the center point and rotation angle, ARC2 is preferable.
The ENDS command informs the controller that no more segments will be specified for the
motion.
Note
If the IMM command occurs either before the start XSEG, or after XSEG
termination, its action follows standard rules of IMM action in idle mode (or
other motion whichever is executed in the moment of IMM command).
If the IMM command is issued, and XSEG motion is at a specific point of execution, all XSEG
segments can be subdivided as follows:
Segments before the current segment; these segments has been passed and are of no
interest.
Current segment the current point belongs to.
Segments after the current segments already included in segment queue and processed by
look-ahead algorithm.
Future segments not included yet in segment queue.
If the IMM command specifies a new velocity, the velocity is expected to affect all XSEG
segments after the current point, including the section of current segment after the current point.
However, there are some limitations:
Individual velocity can be specified for any segment. Individual velocity should not be
exceeded; actual velocity is required to be equal or (in some cases) less than the specified
one.
The look-ahead algorithm may apply additional limitations to velocity on a segment or in
a junction point. The limitations are not eliminated by imm command.
Taking the above considerations into account, the velocity specified by the IMM command is
not a strict velocity setting from this point on; rather it operates as additional limitation that
affects actual velocity along with other limitations.
If the IMM command specifies a new velocity while XSEG motion is in progress, the
controller response includes the following actions:
The specified velocity replaces the required velocity for the rest of the XSEG motion.
Therefore, the new value will act as the required velocity for a segment, if no individual
velocity is specified.
The specified velocity defines velocity restriction for the rest of the XSEG motion. The
velocity restriction will take part in any velocity calculation; so that actual velocity can
appear equal or lower, but not higher than the specified velocity.
The velocity profile for the queued segments, including the section of the current segment
after the current point, is recalculated taking into account the new required velocity and
velocity restriction. This way, operation of imm command is identical for queued and
future segments.
If the IMM command specifies new acceleration or jerk, the new value replaces the required
value for the rest of the XSEG motion. However, unlike the velocity case, the queued segments
are not recalculated. Therefore the new acceleration or jerk takes effect with some unspecified
delay.
There is an additional restriction that if the newly specified velocity is greater than the current
required velocity, the new velocity is not effective for already queued segments; it is effective
for the future segments only. In other words, lower velocity takes effect immediately; greater
velocity takes effect with some unspecified delay.
When the command executes, the controller stores the formula specified to the right of the
equals sign, and then calculates the master value MPOS(0) according to this formula (in the
example above, it simply assigns the current FPOS(1) value to MPOS(0)). The controller does
this calculation every controller period, independent of program execution. Even if the program
that executed the MASTER command terminates, the controller continues calculating the last
specified master expression, until the another master command for the same axis executes.
The master value can be redefined at any time by the application. If the program that executed
the above command then executes the command.
A more sophisticated use of the MASTER command connects the axis to another axis feedback
with a scale factor:
MASTER MPOS(0) = 2.3 * FPOS(1)
The following example defines axis 2 to follow the RPOS (reference position) of axis 0
translated through a conversion table (cam motion):
MASTER MPOS(2) = MAPBY1(RPOS(0), Table)
In this example Table is a user-defined array that contains a table for conversion.
Similarly, the master value may be connected to other sources such as the sum of two or more
axes, or to an analog input.
Slave motion is governed by the variables of the slaved axis. These include:
XSACC Maximal allowed acceleration of the synchronous motion. If the master
acceleration exceeds this value, the slave comes out from synchronism.
SYNV Allowed difference in master and slave velocities. Used in asynchronous
motion to determine if the synchronism can be re-established.
JERK Default jerk. The slave uses this variable only in asynchronous motion to
overtake the master.
ACC Default acceleration. The slave uses this variable only in asynchronous
motion to overtake the master.
VEL Default velocity. The slave uses this variable only in asynchronous motion
to overtake the master.
Once started, slaved motion terminates only if a failure occurs, or one of the commands HALT,
KILL, or BREAK is executed. The HALT and KILL commands provide deceleration to zero
and then the next motion starts. If no next motion was created, the axis becomes idle. The
BREAK command provides smooth transition to the next motion without stopping, if a next
motion is waiting in the queue.
4.7.2.1 Synchronization
In slaved motion the slave is usually synchronized to the master, meaning that the APOS axis
reference follows the MPOS master value strictly or with a constant offset. However, there are
two cases when synchronism is not attainable:
The slaved motion starts, and positions (position lock) or velocities (velocity lock) of the
master and slave differ. The motion starts as asynchronous.
The motion was synchronized, but the acceleration of the master exceeds the allowed limit
(the XSACC variable of the axis) for the slave. The slave comes out of synchronization.
In both cases, the motion continues asynchronously, and the correspondence between APOS
and MPOS appears broken. The controller tries to regain synchronization by having the slave
pursue the master within the maximal allowed motion parameters. When the slave overtakes
the master, synchronization is re-established and the motion continues as synchronous.
Only individual axes are allowed to be used in a SLAVE command. Groups are not allowed.
The created motion starts immediately if the axis is idle; otherwise the motion waits in the
motion queue until all motions created before for the axis finish. The following command
creates a slaved motion of the 0 axis:
SLAVE 0
Note
The slave axis in a master-slave motion may show its state (through the AST
variable) as accelerating and in motion even when the master axis is
motionless. This reflects the fact that the axis is set to follow the motion of
the other axis and is not following a motion profile of its own.
Where C is constant in velocity lock mode and is zero in position lock mode.
When the MSEG command includes the p switch (see Section 4.5.2 - MSEG, LINE, ARC1,
ARC2, STOPPER Commands), this activates the position lock mode of slaved motion. When
synchronized, the APOS axis reference follows the MPOS strictly:
APOS(0) = MPOS(1)
When the motion is asynchronous for any reason (see above), the controller tries to regain
synchronism by having the slave pursue the master with the maximal allowed motion
parameters. The difference between position lock and velocity lock manifests itself at the
moment of regaining synchronization:
Velocity lock motion switches to synchronized when the slave velocity reaches the master
velocity (with allowed error defined by the SYNV variable of the slaved axis). At this
moment the difference between the master position and the slave position is latched as the
constant offset C, which then remains unchanged as long as the motion is synchronous.
Position lock motion switches to synchronized when the slave position overtakes the
master position, i.e., when APOS = MPOS.
Note that each time the motion loses and regains synchronization, the velocity lock offset C
may latch a different value. Under the same conditions, the position lock motion each time re-
establishes the strict equality APOS = MPOS.
Points for arbitrary path motion are defined by POINT and MPOINT commands (see
Section 4.2.2 - MPTP, POINT, MPOINT, and ENDS Commands).
The ENDS command terminates the point sequence. After the ENDS command, no POINT or
MPOINT commands for this motion are allowed.
The trajectory of the motion follows through the defined points. Each point presents the instant
desired position at a specific moment. Time intervals between the points are uniform, or non-
uniform as defined by the t switch.
Motion generated by the PATH command does not use the standard motion profile. Typically,
the time intervals between the points are short, so that the array of the points implicitly specifies
the desired velocity in each point. For this reason, variables VEL, ACC, DEC, JERK have no
affect on this motion.
If the time interval does not coincide with the controller cycle, the controller provides linear
interpolation of the points.
Commands HALT, KILL, KILLALL (see Section 4.1.8 - HALT Command and
Section 4.1.3 - KILL and KILLALL Commands) are executed in a specific way with this
type of motion; as with other motion types, the controller provides a smooth deceleration profile
using DEC (HALT command) or KDEC (KILL, KILLALL commands) for the leading axis.
However, unlike other motions types, the controller does not provide following the motion
trajectory during deceleration.
Arbitrary path motion created without the t switch implies uniform intervals between the
points. If PATH is not specified with the t switch, the time_interval argument has to be
included. The argument defines time interval between the motion points in milliseconds.
If PATH is specified with the t switch, it must not have time_interval specification. Instead,
the time_interval must be specified for each point as an additional argument for the point
command or as additional array column in the mpoint command.
Note
The BREAK command (see Section 4.1.9 - BREAK Command) is not
supported when using the PATH command.
The table defines a functional dependence p=f(x) that cannot be expressed analytically.
The argument values for x in the definition table are knots, and the function values for p are
control points.
A 3rd order polynomial spline provides an approximation of the table-driven function that can
provide the function value not only in the knots, but at any point. Between each two knots the
spline is expressed as:
3
p a0 a1 x a2 x 2 a3 x 3 ai x i
i 0
where coefficients a0, a1, a2, a3 have different values at different intervals.
The SPiiPlus controller also supports two-dimensional splines. In this case, the definition table
is a two-dimensional matrix. Knot points are defined for two arguments x and y, and the matrix
contains corresponding p values. Knot values divide the XY plane into rectangular cells. The
matrix defines the function values in the cell vertices. Within each cell, the interpolating spline
is expressed as:
3
p a
i , j 0
ij xi y j
Many different spline approximations can be provided for one definition table. The SPiiPlus
controller supports two kinds of splines: Catmull-Rom and B-Splines (see description below).
If the distance between the knots in the table is constant, the spline is called uniform. On the
contrary, a non-uniform spline corresponds to a table that contains function values in arbitrary
points. However, the definition table always arranges the knot values in ascending order, so that
xi < xi+1.
All knot points constitute the definition range of the spline. Figure 10 illustrates definition
range of a function defined with six non-uniform knots:
Definition Range
x0x1 x2 x3 x4 x5
Figure 10 Spline Definition Range
In a two-dimensional case, definition range is a rectangular area, as illustrated in Figure 11:
y3
Definition
y2 Range
y1
y0
x0 x1 x2 x3 x4 x5
Definition
range
v1
p1
p2
v2 p4 v4
p0
v0 p3
v3
x0 x1 x2 x3 x4
Definition range
p1
p2
p4
p0
p3
x0 – ( x1 – x0) x0 x1 x2 x3 x4 x4 +( x4 – x3)
b spline
Figure 13 B-Spline - Approximation of Points
Compared to a Catmull-Rom spline, a B-Spline generates a smoother curve. Used in the
controller, a B-spline provides continuous velocity and acceleration; where Catmull-Rom
spline provides continuous velocity only, and acceleration may change by jumping at the
control points.
Features of the B-Spline:
The spline is C2-continuous, meaning the curve, its first and second derivatives are all
continuous functions.
The curve approximates the control points; and does not go through each control point.
The spline yields changing value in the interval from x0 – (x1 – x0) to xN-1+(xN-1 – xN-2).
The spline yields constant value equal to p0 in the interval from- to x0 – (x1 – x0).
The spline yields constant value equal to pN-1 in the interval from xN-1+ (xN-1 – xN-2) to +.
Not-passing the control points is not always a drawback. If values p0, p1, p2… pN-1 are obtained
from some measuring process, the values include measuring error that has a stochastic
component. B-Spline tends to filter out the stochastic error, thereby improving overall
accuracy.
C1-continuous C2-continuous
A section of a two-dimensional spline surface along any direction provides a curve, which is a
corresponding one-dimensional file. For example, a two-dimensional Catmull-Rom spline is
cut on the grid line that corresponds to knot y2. The section is a one-dimensional Catmull-Rom
spline built upon control points p20, p21, p22, … p2,M-1.
The behavior of a two-dimensional spline beyond the definition range is more complex than in
the case of a one-dimensional spline. Figure 14 illustrates the Catmull-Rom spline beyond the
definition range:
yN-1
y0
p 00 ps (x )= p(x, y-1) p0,M- 1
x -1 x0 x1 x M-2 xM-1 x0
Figure 14 Catmull-Ron Spline Beyond the Definition Range
yN
yN-1
yN-2
pw (y )= p(x-1 , y ) Extended range pe (y )= p(xM, y)
p(x , y)
y1
y0
y-1
p-1,- 1 ps (x )= p(x , y - 1 ) p- 1,M
map_ b_ spline
Points for PV and PVT motion are defined by the POINT and MPOINT commands (see
Section 4.9.2.1 - POINT Command and Section 4.9.2.2 - MPOINT Command).
Note
The POINT and MPOINT commands serve the same function for defining
points along the path as the POINT and MPOINT commands for multiple
point-to-point motion (see Section 4.2.2 - MPTP, POINT, MPOINT, and
ENDS Commands); however, the controller employs a different algorithm
when calculating the spline motion.
The ENDS command terminates the point sequence. After the ENDS command, no POINT or
MPOINT commands for this motion are allowed.
The trajectory of the motion follows through the defined points. Time intervals between the
points are uniform, or non-uniform as defined by the t switch.
Motion generated by the PVSPLINE command does not follow the standard motion profile.
Variables VEL, ACC, DEC, JERK have no effect on this motion. The motion profile is
defined exclusively by the positions and velocities specified by the POINT and MPOINT
commands.
The HALT command (see Section 4.1.8 - HALT Command) is executed in a specific way
with this type of motion. As with other motion types, the controller provides a smooth
deceleration profile with the DEC value of the leading axis. However, unlike other motions
types, the controller does not follow the motion trajectory during deceleration.
Spline motion created without the t switch implies uniform intervals between the points. If
PVSPLINE does not include the t switch, the time_interval argument has to be included. The
argument defines time interval between the motion points in milliseconds.
If PVSPLINE does not include the t switch, the time_interval argument must not be included.
Instead, the time interval must be specified for each point as an additional argument for the
POINT command or as additional array row in the MPOINT command.
The PVSPLINE command itself does not specify any point, so the created motion starts only
after the first point is specified. The points of motion are specified by the point or mpoint
commands that follow the pvspline command.
For each segment the controller constructs a third-order polynomial and calculates the reference
coordinates using the polynomial.
The spline provides exact track through the specified points and exact specified velocity at the
points. The spline also provides continuous velocity at all intermediate points.
In general the spline does not guarantee acceleration continuity at the connection points.
However, the acceleration can be continuous if the proper velocity values are specified, and
many host-based programs that prepare data for PV-interpolation actually calculate velocity
values that will provide continuous acceleration.
The time interval between the points may be either uniform or non-uniform. In both cases the
time interval is not required to be an integer or to be equal to an integer number of controller
cycles. The controller uses the exact specified time interval to calculate the interpolated
reference positions.
The following drawing illustrates the PV spline interpolation:
T 2T 3T 4T 5T 6T 7T 8T
In the POINT command the axis_designators must specify the same axes in the same order as
in the axis_designators of the corresponding PVSPLINE command.
The other arguments contain different values depending on corresponding PVSPLINE
command.
If the related motion command is PVSPLINE without the t switch for M axes, there has to be
2*M arguments: 2 arguments per axis involved. The arguments specify the end point
coordinates and the coordinate velocities at the end point in the following order:
The end point coordinate for each axis involved (M values)
The velocity at the end point for each axis involved (M values)
Each coordinate is specified in user units of the corresponding axis, each velocity is specified
in user units per second.
If the related motion command is PVSPLINE/t for M axes, there have to be 2*M+1 arguments:
2*M arguments specify the end point coordinates and velocities, and the last argument specifies
the time interval between the previous and the current point. The time is specified in
milliseconds.
Before the mpoint command can be executed, an array must be declared and filled with
the point coordinates. Each row of the array contains coordinates of one point.
If the related motion command is PVSPLINE without the t switch, for M axes the matrix must
contain 2*M rows, 2 rows per axis involved. The values in each column specify:
in row 1: the end point coordinate for each axis involved (M values)
in row 2: the velocity at the end point for each axis involved (M values)
Each coordinate is specified in user units of the corresponding axis, each velocity is specified
in user units per second.
If the related motion command is PVSPLINE/t, for M axes the matrix must contain 2*M+1
rows:
M rows for end point coordinates
M rows for end point velocities
plus additional row for the time interval between the points. The time is specified in
milliseconds.
controller then executes the motion. As soon as the controller is ready to accept the next batch
of points and the host is ready to send that batch, the next transmission occurs, and so on.
The pace of the host and the controller do not have to be identical. However, the host is assumed
to be fast enough to calculate the next 50 points before the controller has moved through the
previous 50 points.
The controller executes the following program:
real Points(12)(50) Declare an array of 50 points. The host will write
the coordinates and velocities to the array.
int N,HSync,NBuf Declare a synchronization variable (initiated to
zero by default).
PVSPLINE (0,1,2,3,4,5,6), 10 Create PV for axes 0, 1, 2, 3, 4, 5 and 6. Points are
given at 10-millisecond intervals.
WHILE Sync >= 0 Continue until the host writes negative number to
Sync.
TILL Sync Wait until the points are received. Once the host has
filled the Points array, it writes the Sync variable
with a number of points written to the Points array.
IF Sync > 0 Sync greater than 0 indicates that the host has
finished the point generation.
MPOINT (0,1,2,3,4,5,6), Points, Sync Add points to the Points matrix.
Sync = 0 The controller informs the host that the next batch
is expected. The motion through the points already
received from the host has not completed, but the
controller is ready to receive more points.
END End if.
END End while.
ENDS (0,1,2,3,4,5,6) End PVSPLINE.
STOP
The program running on the host looks like the following pseudo code:
double HPoints(12)(50);
int N, HSync;
HANDLE Com;
while (Continue)
calculate N (<= 50) points in array Hpoints;
do
acsc_ReadInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &HSync, 0);
while HSync;
reset Continue to zero if all points have been calculated;
end;
N = -1
acsc_WriteInteger(Com, NBuf, "Sync", -1, -1, -1, -1, &N, 0);
Synchronization between the host and the controller is provided by the Sync user variable.
When the host has finished transmitting the next batch of points to the controller, it writes to
Sync the number of points in the batch. The controller waits for non-zero Sync and then adds
the points to the motion. When the controller has added the points, it writes zero to Sync, which
signals to the host to transmit the next batch of points.
When the host comes to the end, it writes -1 to Sync, to indicate the end of the motion.
Bit 1 in the MFLAGS variable enables or disables open-loop mode. The following diagram
explains transition between the three modes:
Disabled
Mode
Command Command
DISABLE DISABLE
Command Command
ENABLE if ENABLE if
MFLAGS.1=1 MFLAGS.1=0
Command
MFLAGS.1 = 0
Open-loop Enabled
Mode Mode
Command
MFLAGS.1 = 1
The circles in this diagram represent the motor modes and the arrows with rectangles show the
controller commands that switch the controller from one mode to another.
As shown in the diagram, a motor can be switched from the enabled mode to the open-loop
mode and back without changing to the disabled mode. The controller provides a smooth
transition between the modes. Even if the motor experiences uncontrolled movement while in
the open-loop mode, switching back to the enabled mode does not cause any motor jump.
However, be careful if you execute a motion while the controller is in open-loop mode. Once
the command switches back to enabled mode, the controller continues the motion from the
point where it finds the motor. No motor jump occurs, but the motion trajectory and the final
point may be shifted by the value of uncontrolled offset in the open-loop mode.
While in open-loop mode, the controller calculates the drive voltage output based on the
DCOM variable. The DCOM variable sets the drive output as a percentage of the maximum
available drive output voltage. For example, the SPiiPlus PCI 4/8 provides differential drive
output in the range from -10V to +10V. Therefore, assigning 100 to DCOM provides +10V on
the drive output, assigning -100 provides -10V, and assigning 0 provides 0V.
The following program fragment shows an example of torque control implementation through
the open-loop mode.
ENABLE 0 Enable the 0 motor.
PTP/f 0,400,100 Move to the point where the contact search
begins. Provide low (search) velocity of 100
count/sec in the final point.
Many applications with step motors require the motion velocity to be restricted from below. In
this case, the motion profile has non-zero start and finish velocity. To handle this case you can
use the NVEL variable (see SPiiPlus Command & Variable Reference Guide) that specifies
minimal velocity for each axis. If an application sets a non-zero NVEL for some axis, the
controller uses the value as start and finish velocity in any motion related to the axis except for
an axis that is governed by the PATH or PVSPLINE command.
If an NVEL element is zero, the normal motion profile starts from zero velocity and finishes at
zero velocity. If an element is non-zero, in the beginning of motion the velocity immediately
jumps to the value specified in the NVEL element and then continues normal motion profile.
In the end, the motion approaches the final point at velocity specified in the NVEL element,
then the velocity immediately drops to zero.
In a typical application, the step motor does not require acceleration build-up phases; the
motion profile is trapezoidal:
GPHASE = 0 2 4 6
VEL
NVEL
Time
KILL and HALT commands are also affected, i.e., they slow down the velocity to the value
specified in the NVEL element and then the velocity drops to zero.
If the absolute value of the VEL value is less than the NVEL value, the VEL value is ignored.
In this case the motion profile is rectangular:
GPHASE = 0 4
NVEL
Time
Also ignored are the velocity specified in a motion command or in an IMM command if its
absolute value is less than NVEL. In all cases, the actual motion velocity is not less than NVEL.
Multi-axis motion is not typical for an axis with non-zero minimal velocity. If, however, the
axis is involved in multi-axis motion, the controller uses NVEL as follows:
If the axis is a leading axis in the motion, its NVEL is used as a minimal vector velocity in
the motion profile
If the axis is not leading, its NVEL is ignored.
In both cases, the axis velocity can be lower than the NVEL value. Therefore, be careful in
defining multi-axis motion that involves both stepper motors and servo motors.
If a non-default connection is specified (see Section 8.12 - Non-Default Connections), the axis
and the motor are different entities. In this case, NVEL refers to the axis, but not to the motor.
For example, if NVEL0 is set to 500, the velocity of any motion of the X axis will be limited
from below to 500 units per second irrespective of which motor is affected by the motion.
Note
When you are operating a system whose configuration is currently unknown,
you can use the Terminal command: #SI (see SPiiPlus ACSPL+ Command
& Variable Reference Guide for details on Terminal commands) to find out
the correlation between the IN/OUT array indexes and I/O.
Where:
IN Integer array IN, a read-only array
OUT Integer array OUT
port_# The port number to which the bits belong. The controller’s digital
input/output ports are numbered from 0 to N-1, where N is the number
of controller ports (see the controller’s Hardware Guide for the number
of input/output for your controller).
.bit_# The specific bit within the port. Each port is divided into 32 bits that
are numbered from 0 to 31. For example:
IN0.1 – input 1 of port 0
IN3.19 – input 19 of port 3
OUT0.5 – output 5 of port zero
OUT3.19 – output 19 of port 3
Rather than explicitly designating the port number, you can use an integer user-defined variable
that equates to the number. In this case you have to include the parentheses, for example:
IN(u_var).1 - where u_var is an integer variable the value of which equates to the port number.
Note
If the controller provides only 32 inputs or less, all inputs/outputs are
located in port zero. In this case the port number can be omitted, and input
is referred as: IN.0 (for input 0), IN.22 (for input 22), OUT.0 (for output 0),
OUT.2 (for output 2), etc.
1 real T1
2 int Bits
3 Start:
4 OUT0.0 = MST0.#INPOS
5 if T1 <= TIME
6 if Bits.0 T1 = T1 + 30000 else T1 = T1 + 15*60000 end
7 Bits.0 = ^Bits.0
8 end
9 OUT0.4 = IN0.4 & Bits.0
10 goto Start
11 on IN0.15; killall; ret
Line1 – Definition of local variable T1 that is used to store the next switch time. T1 may be
defined as integer, but as a real, it can provide continuous running for an extended period
without overflow. The program relies on the automatic initialization of all local variables to
zero when they are declared.
Line2 – Definition of a local variable: Bits. In this program only one bit of Bits is used. One
temporary integer variable can be used for storing 32 temporary bits.
Line3 – A label: Start. A typical case in PLC programming is a long program cycle that
executes to the end and returns to the beginning. In the example shown above, the execution
period is quite short even with default rate of ‘one Line per each controller cycle’. In a long
program, the execution cycle can reach hundreds of milliseconds.
This is a good reason to divide a typical PLC program into slow and fast sections.
Line 4 – OUT0.0 reflects the ‘in position’ state of the motor. If the motor is not in position, the
output is 0. If it is in position, the output is 1.
Lines 5-9 – OUT0.4 controls a periodic activity that must be executed every 15 minutes for a
30-second period. It is executed only if IN0.4 is active. In a typical application, the output might
be connected to lubrication pump.
Line10 – Returns the motion to the Start point.
Line11 – An autoroutine that provides extra fast response to IN0.15, typically an emergency
input. The whole autoroutine is implemented in one line providing an immediate kill of all
motions within one controller cycle when input port 0 bit 15 is 1.
Note
When you are operating a system whose configuration is currently unknown,
you can use the Terminal command: #SI (see SPiiPlus ACSPL+ Command
& Variable Reference Guide for details on Terminal commands) to find out
the correlation between the AIN/AOUT array indexes and I/O.
The range of the AIN and AOUT arrays depends on the type of the input or output and the bit
resolution of the Analog-to-Digital or Digital-to-Analog conversions.
Example: For ±10V analog outputs with 16-bit Digital-to-Analog conversion resolution,
the AOUT range is from -32768 (for –10V) to +32767 (for +10V).
Example: For ±1.25V analog inputs with 14-bit Digital-to-Analog conversion resolution,
the AIN range is from -8192 (for –1.25V) to +8192 (for +1.25V).
Note
If an analog output is connected to a drive, it has a dedicated destination and
cannot be used as a general purpose analog output.
For model-dependent analog I/O information (for example, the number and range of inputs and
outputs) see the controller’s Hardware Guide.
Note
FVEL is calculated by digital differentiation of FPOS.
FACC is calculated by digital differentiation of the FVEL variable.
The ACSPL+ FVFIL variable defines a power of the smoothing filter used
in the FVEL calculation (see SPiiPlus Command & Variable Reference
Guide).
Example:
The following ACSPL+ program assigns X-axis feedback position to output #3 and
acceleration to output #1. In the example the user variables: SF1 and SF2 are scale factors.
real SF1, SF2;
SF1=0.01 ; SF2=0.001; !Define scaling factors
While 1;
AOUT3 = FPOS0 * SF1;
AOUT1 = FACC0 * SF2;
END
6 Fault Handling
Fault handling is not only a concern for isolating motion faults, it is also a vital concern to
personal and equipment safety.
Safety features are necessary to protect both the equipment and you from potential injury.
SPiiPlus controllers include numerous safety-related features, but the final responsibility for the
safe use of the controller in a particular application lies with you. Before you create your
application make sure that you thoroughly read and understand this chapter.
This chapter addresses:
Safety Controls
Working with Fault Procedures
Warning
Some alarms, limits, and errors involve protection against potentially
serious bodily harm and equipment damage. Be aware of the
implications before changing or disabling any alarm, limit, or error.
Safety control is one of the highest-priority tasks of the controller. The controller continually
monitors safety conditions each controller cycle, in parallel to its other activities.
The controller sets one of the fault bits of the ACSPL+ FAULT variable when it detects a
malfunction. The response to a fault may vary from sending a fault message to complete
termination of all activities. For each fault type you can enable/disable the default controller
response or define your own autoroutine response.
6.1.3 Faults
When the controller detects a malfunction, it raises a specific fault bit. Fault bits are grouped
into ACSPL+ FAULT and S_FAULT variables.
In certain cases, you may want to define which fault conditions are examined in a specific
application. The ACSPL+ FMASK and S_FMASK variables specify which fault conditions
must be examined in a particular application.
See SPiiPlus Command & Variable Reference Guide for complete details of these variables.
Note
In the table Right Limit restricts the motion in the positive direction and the
Left Limit in the negative direction.
The physical signal connected to a safety input may indicate a safety violation with either high
or low level. For instance on one axis, the right limit switch may indicate a safety violation with
high voltage, and the left limit switch with low voltage. Use the ACSPL+ SAFINI and
S_SAFINI variables to define which level is active, thereby eliminating the need for hardware
inverters.
Table 10 Safety Inputs
Bit Fault Fault Category Fault Description
0 #RL Motor RIGHT LIMIT SWITCH
1 #LL Motor LEFT LIMIT SWITCH
9 #DRIVE Motor DRIVE ALARM - alarm signal from
a drive.
28 #ES System EMERGENCY STOP - alarm signal
from the controlled plant.
Note
You can also use the ACSPL+ USAGE variable (see SPiiPlus Command &
Variable Reference Guide) to monitor the usage. This variable is
particularly useful in autoroutines for halting a program if the MPU usage
is excessive.
#UNPROTECT
The #UNPROTECT command disables application protection (returns the controller to
configuration mode).
Note
If #PROTECT was applied with a password, the same password must
accompany the corresponding #UNPROTECT command. If a password
was not included in the #PROTECT command, the #UNPROTECT
command does not need a password.
For a description of the application protection commands see SPiiPlus Command & Variable
Reference Guide.
Use the bit designators of the system faults to address the system fault bits.
Examples:
S_FAULT.#ES Addresses the Emergency Stop fault bit. The bit is raised when the Emergency
Stop safety signal is active.
S_FAULT.#PROG Addresses the Program fault bit. The bit is raised when any program has failed
due to a run-time error.
The number in the left column is the bit number, followed by an ON/OFF indicator and the fault
description and the bit name in parentheses. In the above example all the faults are OFF except
for the Left Limit fault of one or more axes.
Note that the S_FAULT variable indicates that there is a motor fault, but does not specify
which motor has failed. To determine which motor has failed, query the FAULT variable, or
use ?$ to query the state of all motors.
Fault bits can be queried individually:
?S_FAULT.#LL
1
?FAULT(0).#LL, FAULT1.#LL
0
1
The controller answers a query of an individual bit by showing the numerical value of the bit:
either 0 or 1.
The condition if S_FAULT is satisfied if S_FAULT is non-zero, i.e., if any bit of S_FAULT
is raised. Any fault, either system or motor, raises a bit in S_FAULT. Therefore a non-zero
S_FAULT indicates that one or more faults are active.
The variables FAULT and S_FAULT display the current state of the faults. A conditional
command based on these variables uses the fault state at the instant when the command is
executed. For example, if the X left limit was activated but then released, FAULT0.#LL is
zero, and the command if FAULT0.#LL considers the condition unsatisfied.
A fault-processing autoroutine can reside in any program buffer. When the buffer is compiled,
the controller checks the autoroutine condition each controller cycle. When the condition is
satisfied, the controller interrupts the program that is currently executing in the buffer that the
autoroutine resides in, and starts the autoroutine execution.
A fault-processing autoroutine can supplement or replace the default response to a fault. If the
corresponding FDEF or S_FDEF bit enables the default response, the autoroutine starts and
executes in parallel with the default response. If the corresponding FDEF or S_FDEF bit is
zero, the default response is disabled, and the autoroutine is the only controller response.
Examples:
The following autoroutine displays a message when the Drive Alarm signal becomes active for
the 0 axis motor:
on FAULT(0).#DRIVE
disp "Axis 0 Drive Alarm"
ret
In the following autoroutines, the 0 and 2 axes motors must be disabled simultaneously.
Therefore, if one of the drives fails, the second must be disabled as well. The default response
disables the 0 axis motor if the 0 Drive Alarm occurs and disables the 2 axis motor if the 2 Drive
Alarm occurs. The following pair of autoroutines supplements the default response by disabling
a motor if the other motor fails:
on FAULT(0).#DRIVE disable 2; ret
on FAULT(2).#DRIVE disable 0; ret
When a 0 axis drive fault occurs, the following autoroutine terminates the controller activity for
all motors:
on FAULT(0).#DRIVE When 0 axis drive fault occurs
disableall Disable all motors
stopall Stop all other programs
stop Stop the current program
ret End of autoroutine
The S_FAULT variable contains the bits of the aggregated motor faults. These bits provide a
convenient alternative to the motor faults if an application requires common processing of a
motor fault irrespective of which motor caused the fault.
For example, the following autoroutine displays a message when the Left Limit switch of any
motor is activated:
on S_FAULT.#LL
disp "One of the Left Limit Switches is Activated"
ret
Autoroutine conditions can contain more than one fault bit, as is shown in the first line of the
example below:
on S_FAULT.#LL | S_FAULT.#RL
disp "Some Limit Switch Activated"
ret
The S_FAULT variable (used without a bit extension) indicates whether a fault has been
detected by the controller. The following example shows an autoroutine that provides an alarm
message if any fault occurs in the controller:
on S_FAULT
disp "Something happened"
ret
The controller activates an autoroutine when the condition of the autoroutine changes from
false to true. If the condition remains true, the autoroutine is not activated again until the
condition becomes false, and then true again. Therefore the above autoroutine displays the
alarm message only on the first fault. If one fault bit is already raised, and another fault occurs,
the second fault does not generate an alarm message.
The following autoroutine displays a fault message each time a fault occurs:
int LastFault
on LastFault <> S_FAULT
if (LastFault ~ S_FAULT) & S_FAULT
disp "Something happened"
end
LastFault = S_FAULT
ret
In the above example the local variable LastFault stores the current value of S_FAULT. The
exclusive OR (~) of LastFault and S_FAULT detects the bits of S_FAULT that changed. The
AND (&) with S_FAULT retains only the bits that changed from zero to one, and not from one
to zero.
Warning
Certain safety variables provide protection against potential serious
bodily injury and damage to equipment. Be aware of the implications
before disabling any alarm, limit or error.
The ACSPL+ variables define which faults are examined and processed. If a bit of FMASK or
S_FMASK is zero, the corresponding fault is disabled and the bit of FAULT or S_FAULT is
not raised.
FMASK and S_FMASK are queried like any other variable, and the controller reports the
status of each meaningful bit.
Example:
?FMASK(0)
0 ON Right Limit (#RL)
1 ON Left Limit (#LL)
2 ON Network error (#NT)
4 ON Overheat (#HOT)
5 ON Software Right Limit (#SRL)
6 ON Software Left Limit (#SLL)
7 ON Encoder Not Connected (#ENCNC)
8 ON Encoder 2 Not Connected (#ENC2NC)
9 ON Driver Alarm (#DRIVE)
10 OFF Encoder Error (#ENC)
11 OFF Encoder 2 Error (#ENC2)
12 ON Position Error (#PE)
13 ON Critical Position Error (#CPE)
14 ON Velocity Limit (#VL)
15 ON Acceleration Limit (#AL)
16 OFF Overcurrent (#CL)
17 OFF Servo Processor Alarm (#SP)
20 OFF HSSI Not Connected (#HSSINC)
?S_FMASK
25 ON Program Error (#PROG)
26 OFF Memory Overuse (#MEM)
27 OFF Time Overuse (#TIME)
28 ON Emergency Stop (#ES)
29 OFF Servo Interrupt (#INT)
30 OFF Integrity Violation (#INTGR)
31 OFF Component Failure (#FAILURE)
Normally, you enable or disable fault detection through the Adjuster wizard of the SPiiPlus
MMI Application Studio (see the SPiiPlus MMI Application Studio User Guide) when initially
configuring the controller. The configured values of FMASK and S_FMASK are then stored
in the flash memory and left unchanged during the application lifetime.
Changes to safety variables after initial controller configuration may affect your application.
The following section is relevant only if you need to enable or disable faults after initial
configuration.
Example:
?FAULT(0).#DRIVE , SAFIN(0).#DRIVE Display the status of the 0 drive alarm fault, and the
safety signal
1 Drive Alarm fault bit is set.
1 Drive Alarm safety signal is set.
FMASK(0).#DRIVE = 0 Disable 0 axis Drive Alarm fault
?FAULT(0).#DRIVE , SAFIN(0).#DRIVE Display the status of the 0 axis Drive Alarm fault,
and the safety signal
0 Drive Alarm fault bit is reset.
1 Drive Alarm safety signal is still set.
?S_SAFINI
28 OFF Emergency Stop (#ES)
31 OFF Component Failure (#FAILURE)
In the above example, the fact that the response to the SAFINI(0) query shows that RL and LL
are ON (bits 0 and 1) indicates that you have defined inverse polarity (low active level) for
signals #RL, #LL of the 0 axis.
Normally, you define the signal polarity through the Adjuster wizard of the SPiiPlus MMI
Application Studio (see the SPiiPlus MMI Application Studio User Guide) when initially
configuring the controller. The configured values of SAFINI and S_SAFINI are then stored in
the flash memory and are not changed during the application's lifetime.
Example:
?FAULT(0).#LL , SAFIN(0).#LL Display the status of Left Limit and the Left Limit
Safety signal for the 0 axis.
1 Left Limit fault bit is raised.
1 Left Limit safety signal is high.
SAFINI(0).#LL = 1 Set inverse polarity
?FAULT(0).#LL , SAFIN(0).#LL Display the status of Left Limit and the Left Limit
Safety signal for the 0 axis.
0 Left Limit fault bit changes to zero.
1 Left Limit safety signal remains high.
Under normal conditions the motor continuously moves forward and backward by 10,000 units.
Assume, however, that the first motion brings the motor to the right limit switch. The first
motion terminates prematurely, because the motor is killed. However, the program continues
running and executes the second motion command. In the regular mode the second motion
starts successfully because it is directed out of the limit. Then the first motion command again
brings the motor to the limit. Therefore, in the regular mode the reciprocated motion continues
and there is no clear indication of abnormal condition.
Assume further, for the same application, that a broken connection to the right limit switch
causes the controller to mistakenly continuously detect that the right limit has been passed. The
first motion fails immediately after start, but the second one executes. The result is that the
motors move in a negative direction by steps of 10,000 units.
In the strict mode, the behavior is more predictable. After the first motion failed, the second one
cannot start and the program itself terminates with error. You can check the information in
MERR and PERR to disclose the reason for the failure.
If at any point of the application a fault is an expected condition and the program must continue,
the program in the strict mode must analyze the MERR element and execute the FCLEAR
command before activating the next motion.
Note
Other nodes may keep functioning, if their response to Network Fault is
masked.
= Hazardous Area
= Prohibited Area
=Limit Switch
Autoroutine examples:
The first example supplements the default processing of X limit faults with alarm messages:
ON FAULT(0).#LL When a Left Limit fault occurs in the 0 axis motor.
DISP "0 Left Limit switch activated" Display the message: 0 Left Limit switch activated.
RET
ON FAULT(0).#RL When a right limit fault occurs in 0 axis motor.
DISP "0 Right Limit switch activated" Display the message: 0 Right Limit switch
activated.
RET
The example below implements an autoroutine that disables the motor rather than the default
response of killing the motion in case of a right limit or left limit fault. This response may be
superior to the default response if the motor is equipped with a brake that is activated by the
disable command because the brake may stop the motor faster than a kill command.
ON FAULT(2).#RL | FAULT(2).#LL. When there is a right limit or left limit fault in the 2
axis motor.
DISABLE 2 Disable axis 2
RET
Autoroutine examples:
The following autoroutines supplement the default processing of X software limit faults with
an alarm messages:
ON FAULT(0).#SLL
DISP "0 Software Left Limit violated"
RET
ON FAULT(0).#SRL
DISP "0 Software Right Limit violated"
RET
Use the #PE fault to detect non-critical violation of position accuracy, and the #CPE (see
Section 6.5.5 - Critical Position Error: #CPE) fault to detect uncontrolled, excessive error
that indicates loss of control.
The following ACSPL+ variables are associated with position errors:
ERRI – Maximum position error while the motor is idle (not moving)
ERRV – Maximum position error while the motor is moving with constant velocity
ERRA – Maximum position error while the motor is accelerating or decelerating
DELI – Delay on transition from ERRA to ERRI
DELV – Delay on transition from ERRA to ERRV
The controller raises the FAULT.#PE bit if the position error exceeds the maximum specified
value, which is equal to ERRI, ERRV or ERRA depending on the motion state.
The variables DELI and DELV are used in a similar manner with the #CPE fault.
The following diagram illustrates the use of these variables for a typical motion profile that
includes acceleration, constant velocity and deceleration:
V
PE > ERRI PE > ERRA PE > ERRV PE > ERRA PE > ERRI
DELV DELI
The next example corrects the motion conditions by reducing the velocity (VEL1) until the
error returns to within limits, instead of killing the motion.
ON FAULT(1).#PE When there is a position error fault in the 1 axis
motor.
WHILE FAULT(1).#PE As long as there is a position error.
IMM VEL(1) = 0.9 * VEL(1) Reduce the velocity of the 1 axis motor by 10%.
WAIT 10 Delay.
END
RET
An application that incorporates the above autoroutine must satisfy the following conditions:
All motions of the 1 axis are single-axis, or 1 is a leading axis in a group. If another axis is
leading, all motions will use the velocity of that axis, and the command VEL(1) = … will
have no effect.
All motions of the 1 axis use the default velocity VEL(1) and do not specify individual
velocity.
The specific error monitored is the position error only while the motor is moving with
constant velocity. To avoid the fault while the motor is idle or moves with acceleration, you
have to initialize the variables ERRI(1) and ERRA(1) to sufficiently large values.
Use #PE fault (see Section 6.5.4 - Non-Critical Position Error: #PE) to detect non-critical
violations of position accuracy, and the #CPE fault to detect uncontrolled, excessive error that
indicates loss of control. #CPE should be greater than #PE.
The following ACSPL+ variables are associated with critical position error:
CERRI - Critical position error if the motor is idle (not moving)
CERRV - Critical position error if the motor is moving with constant velocity
CERRA - Critical position error if the motor is accelerating or decelerating
DELI - Delay on transition from CERRA to CERRI
DELV - Delay on transition from CERRA to CERRV
The variables DELI and DELV are used also in the condition for the #PE fault.
The controller raises the fault bit if the position error exceeds the critical value. The critical
value is equal to CERRI, CERRV or CERRA depending on the motion stage. The following
diagram illustrates the use of these variables for a typical motion profile that includes
acceleration, constant velocity and deceleration:
V
CPE > CERRI CPE > CERRA CPE > CERRV CPE > CERRA CPE > CERRI
DELV DELI
Unlike most faults, #ENC and #ENC2 faults are latched. The fault bits remain raised even after
the cause of the fault has been eliminated. Only the next enable command resets the fault bits.
Occurrence of an #ENC fault indicates a serious problem in motor control. Do not disable the
default response unless it is absolutely necessary in your application, i.e., keep
FDEF.#CPE = 1.
Autoroutine examples
The following autoroutine supplements the default response with an alarm message:
ON FAULT(2).#ENC
DISP "Encoder Error in 2 axis. The motor was disabled."
RET
If the controller detects a pair of differential encoder inputs that are not in opposite states (high
and low level), it raises the fault because this may indicate a problem such as a short circuit or
unconnected wire.
An #ENCNC fault indicates a serious problem in motor control. Do not disable the default
response unless it is absolutely necessary in your application, i.e., keep FDEF.#CPE = 1.
Autoroutine examples
The following autoroutine supplements the default response with an alarm message:
ON FAULT(0).#ENCNC
DISP "Axis 0: Encoder Not Connected. The motor was disabled."
RET
Autoroutine examples:
The first autoroutine activates the OUT(0).1 output, which could be wired to switch on an
additional motor ventilation fan. The second routine switches off the fan when the fault is no
longer active:
ON FAULT(1).#HOT
OUT(0).1 = 1
RET
ON ^FAULT(1).#HOT
OUT(0).1 = 0
RET
Autoroutine example:
The autoroutine informs you about the violation.
ON FAULT(2).#VL
DISP "Axis 2 velocity limit was exceeded"
RET
The current limit fault is based on the Servo Processor algorithm that calculates the RMS value
of the motor current. When the calculated RMS current exceeds the allowed value the Servo
Processor reports an error that the MPU translates into a current limit fault.
Current limit processing uses the following ACSPL+ variables:
XRMS – Maximum allowed RMS current for each motor
XCURI – Maximum instantaneous current if the motor is idle (not moving)
XCURV – Maximum instantaneous current if the motor is moving
Use the SPiiPlus MMI Application Studio Safety and Faults Configurator to configure the
specified variables.
Autoroutine example:
The following autoroutine kills the motion (and displays an alarm message) instead of the
motor. (The default response can be disabled by adding FDEF.#CL = 0 to the ACSPL+
program.)
ON FAULT(1).#CL
KILL 1
DISP "Axis 1 RMS current limit exceeded. Motor halted."
RET
#SP indicates that communication between the MPU and one of the servo processors failed.
The occurrence of the #SP fault indicates a serious hardware problem.
Do not disable the default response unless it is absolutely necessary in your application, i.e.,
keep FDEF.#SP = 1.
This fault may be caused by a problem in the SP program. If the SP program hangs, the fault
remains permanent. If the SP program time exceeds the tick time (50 sec), the fault is
intermittent.
The disable reason reported by the controller is 5027 'Servo Processor Alarm'.
Autoroutine example:
The following autoroutine supplements the default response with an alarm message.
ON FAULT(1).#SP
DISP "Axis 1 Servo Processor Alarm"
RET
Autoroutine example:
The following autoroutine kills all motions but does not disable the motors (this assumes that
the default response has been disabled by S_FDEF.#ES = 0).
ON S_FAULT.#ES
KILLALL
RET
Unlike most faults, the #PROG fault is latched. Once raised, the bit remains raised until the
controller resets it on execution of any command that compiles or starts a program in any buffer.
Autoroutine examples:
The following autoroutine supplements the controller's default response, terminating all
concurrent programs and displaying an alarm message.
ON S_FAULT.#PROG
STOPALL
DISP "Run-time error"
RET
Note that a run time error in a buffer stops all activity in the buffer. Therefore, the above
autoroutine cannot intercept an error that occurred in the buffer where the autoroutine is
located. However, it intercepts an error in any other buffer.
This autoroutine can supplement the default response (S_FDEF.#PROG = 1) or can replace it
(S_FDEF.#PROG = 0).
The following autoroutine does the same (stops all programs) and also provides a diagnostic
message.
ON S_FAULT.#PROG
STOPALL
I0 = 0
LOOP IO
IF PERR(I0) >= 3020
DISP "Program ", I0, " failed. Error ", PERR(I0)
END
IO = 1O + 1
END
RET
The ACSPL+ PERR variable contains the termination codes of the ACSPL+ programs. Each
element of PERR contains a termination code for a different buffer. At power-up all elements
of PERR are reset to 0. When a program in any buffer finishes or terminates for any reason, the
corresponding element of PERR is assigned with a code that specifies the termination reason.
The element resets to zero again once the corresponding buffer is compiled or its program
execution starts.
Termination codes from 3000 to 3020 indicate normal termination. Codes greater than or equal
to 3020 indicate run-time errors (see SPiiPlus Command & Variable Reference Guide for a
complete breakdown of the termination codes).
Unlike most faults, the #MEM fault is latched. Once raised, the bit remains raised until the
controller resets it on execution of any command that compiles or starts a program in any buffer.
Because the controller uses dynamic memory handling, the amount of the memory available for
a specific user application cannot be exactly determined. If an application raises this fault, you
need to reduce the size of the application or add memory.
The following recommendations may be useful in eliminating the error:
Reduce the length of ACSPL+ programs.
Reduce the volume of user local and global variables. Pay special attention to arrays.
Limit the length of commands that are sent to the controller. Do not use commands that
exceed 2032 characters.
Simplify the formulae used with the CONNECT and MASTER commands.
Autoroutine example:
The following autoroutine terminates all executing programs and displays an error message
when the fault occurs.
ON S_FAULT.#MEM
STOPALL
DISP "Memory overflow"
RET
This routine can supplement the default response (S_FDEF.#PROG = 1) or can replace it
(S_FDEF.#PROG = 0).
The controller raises the fault bit when the user application consumes too much processing time
and S_FMASK.#TIME bit is raised.
The structure of the controller’s realtime cycle is discussed in Section 2.1.3 - Realtime and
Background Tasks.
As the realtime processing time varies between cycles, the fault may occasionally occur and
requires no special attention. However, frequent or permanent occurrence of the fault requires
measures to correct the situation.
The controller has no default response to the fault. To monitor this fault, you must define your
own autoroutine.
The following recommendations may be useful in reducing real time processing time, thereby
eliminating the fault:
Reduce the number of concurrently executed programs.
Reduce the program execution rates (variables PRATE, ONRATE).
Reduce the number of command specified in one program line.
Reduce the number of autoroutines.
Simplify the conditions in the autoroutines.
Reduce the number of concurrently executed motions.
Avoid short-time motions.
Use segmented motion instead of a series of short PTP motions.
Simplify the formula used in the connect and master commands.
Autoroutine example:
The following autoroutine accumulates statistics on the fault. The routine measures a time of
1000 fault occurrences and then displays the average time between faults. The routine relies on
zero initialization of the local variables.
Local int N Declare local variable for counting the
number of faults.
Local real ATIME Declare local variable that will show
the time of 1000 faults.
Caution
The Servo Interrupt fault indicates a serious failure. Do not disable the
default response unless it is absolutely necessary in your application,
i.e., keep FDEF.#INT = 1.
The MPU sets the fault if the 1ms interrupt is not received. The probable cause is a hardware
problem. The controller response to the fault is to disable all motors. The disable reason
reported by the controller is 5029 'Servo Interrupt'.
Autoroutine example:
The following autoroutine supplements the default response with termination of all ACSPL+
programs and an alarm message.
ON S_FAULT.#INT
STOPALL
DISP "Main interrupt is missing"
RET
The controller provides special functions that retrieve the card malfunctioned information
(according to address on the I2C bus) and the fault reason. This allows to user to write an
ACSPL+ application that provides user-defined responses for different component faults. The
components that have such outputs provide a special jumper that connects or disconnects the
fault output to the controller.
Model
Currently only MC4U systems support these variables.
Component Failure fault is treated as any other system fault. There is a dedicated bit 31
(#FAILURE) for this fault in S_FAULT, S_FMASK, S_SAFIN, S_SAFINI and S_FDEF.
31 24 23 16 15 14 0
IF(nexterr)
GOTO REP
RET
Note
The SAFIN and S_SAFIN variables are normally read-only. However, they
can be written to when working with the Simulator, to simulate safety inputs.
Internal Safety
Conditions
XOR
Variable FMASK
AND
Variable FAULT
Internal Safety
Conditions XOR
Variable S_FMASK
AND
Variable S_FAULT
assigns a value of 1 to variable V0 if the Drive Alarm signal of the 0 axis motor is high and -1
if low.
The SAFINI configuration variable defines which level of motor safety input causes a fault. In
the above diagram XOR is a bit-wise operation. Therefore, if a bit of SAFINI is zero, high
voltage of the corresponding signal causes fault. If a bit of SAFINI is 1, low voltage causes
fault. Only those bits of SAFINI that correspond to the meaningful bits of SAFIN are used in
fault processing. Other bits have no effect.
In addition to the safety inputs, the controller examines a number of internal safety conditions
for each motor each controller cycle. The faults caused by the motor safety inputs and the faults
detected by internal conditions provide a set of motor faults.
A detected motor fault is stored in a bit of variable FAULT only if the corresponding bit of
variable FMASK is 1. If a bit of FMASK is zero, the controller does not raise the
corresponding fault bit even if the fault condition or safety input is true. If a bit of FMASK is
set to 1, the corresponding bit of FAULT is immediately set when the fault occurs. The bit rises
to 1 or drops to zero in the same controller cycle as the corresponding safety input or internal
safety condition shows change in the fault state.
Only those bits of FAULT that correspond to the motor faults are meaningful.
When a bit is raised, it activates the default response to the fault. An Autoroutine that processes
the fault must use the bit of FAULT in as the condition.
Warning
The controller's default safety configuration and responses fit the
needs of most applications.
Only an experienced user should make modifications to the safety
configuration. Improper configuration may result in unsafe operation,
may damage the equipment, and may constitute a hazard to
personnel.
As mentioned earlier in this chapter, the controller response to a fault can be modified with the
ACSPL+ FDEF/S_FDEF variables and with autoroutines.
The #SC terminal command reports the current safety system configuration (see Section 6.2.7
- Report Safety Configuration).
There are several other options for safety system configuration:
Safety groups
Two or more axes can be combined in a safety group. All axes belonging to the safety
group respond to any fault synchronously. If a fault affects one axis in the group, it
immediately affects all the other axes in the group (refer to the SAFETYGROUP
command in the SPiiPlus Command & Variable Reference Guide).
Kill -disable response
In response to a fault, the controller executes KILL, decelerates the motor to zero velocity,
and then disables the motor.
Changing response without an autoroutine
An axis can respond to a fault in one of the following basic ways:
• No response
• Kill response
• Disable response
• Kill-disable response
For each type of fault, the controller defines a default response, which can be overridden
with an autoroutine. The SAFETYCONF command (refer to the SAFETYCONF
command in the SPiiPlus Command & Variable Reference Guide) switches an axis
between the four basic fault responses. An autoroutine is only required if the desired
response is not one of the these.
Fault generalization
The fault response for a specific fault and a specific axis can be generalized to affect all the
axes. For example, by default the 0 Drive Alarm fault disables the 0 axis motor, but has no
affect on the 1 axis motor or any other motor. However, if you generalize the Drive Alarm
fault for axis 1, the 1 axis motor will be affected by a Drive Alarm fault on any axis.
M2ARK – Secondary Mark Position, array of eight elements, reads the position of the last
encountered Mark2 signal.
FAULT – Faults, array of eight elements, the bits of the variable report the axis-related
faults detected by the safety control
S_FAULT – System Faults, scalar, the bits of the variable report the system faults detected
by the safety control.
IN – General Purpose Inputs, array of eight elements, each bit reports the state of one
general-purpose input.
OUT – General Purpose Outputs, array of eight elements, each bit defines the state of one
general-purpose output.
AIN – Analog Inputs, array of 16 elements, each element reads the numerical value of the
voltage supplied to one analog input. The number of analog inputs varies depending on the
controller model.
AOUT – Analog Outputs, array of 16 elements, each element defines the voltage generated
by one analog output. The number of analog inputs varies depending on the controller
model.
EXTIN – Extended Inputs, array of eight elements, each bit represents a bit in the input or
HSSI register.
EXTOUT – Extended Outputs, array of eight elements, each bit represents a bit in the
HSSI register
Where:
Feedback resolution 2000 lines/rotation
Internal Multiplier x4
User units 360 degrees per rotation
EFAC value 0.045 (i.e., 360/(2000*4))
Where:
Feedback resolution 2 micron (500 lines/mm)
Internal Multiplier x4
User units mm
EFAC value 0.005 (i.e., 1/(500*4))
Where:
Feedback resolution 500 lines/mm
Internal Multiplier x64
User units mm
EFAC value 0.00003125 (i.e., 1/(500*64))
Where:
Feedback resolution 2000 lines/ rotation
Gear ratio 1 motor rotation=0.5mm motion of load
Internal Multiplier x4
User units mm
EFAC value 0.000625 (i.e., 1/(2000*4*(1/0.5)))
Note
The above is only accurate for Digital encoders.In the case of SIN-COS
encoders, FPOS(0) is an interpolated value that contains a position in
between zero-crossing of the SIN-COS signals.
Interpolation is done in the software and the hardware has the ability of
latching only the zero crossings of the sine-cosine.So when you reset
IST(0).#IND on the rising edge of the pulse, it latches the current value of
the zero-crossing counter.
This is a low resolution counter that counts the quadrants of the SIN-COS.
If the rising edge is detected a little bit before the zero crossing, the counter
still has the previous zero-crossing position as shown in the following
diagram:
The latching is done on the “Quad” signal that has a coarse resolution.So
IND holds the zero-crossing position of SIN-COS only.
The following program fragment reports the index value each time that the index is
encountered:
IST0.#IND = 0 Reset any index encountered previously
INDREP Start of the loop
TILL IST0.#IND Wait until the index is latched
DISP IND0 Report the index position
IST0.#IND = 0 Reactivate index latching
GOTO INDREP Go to the start of the loop
Note
Maximum index/mark detection frequencies by an ACSPL+ programfor
different Controller Cycle Time (CTIME) values:
• 1 msec: 50Hz
• 0.5 msec: 100Hz
• 0.2 msec: 250Hz
controller. You can connect signals to inputs or outputs and process them as required by the
application.
The inputs are represented by the integer array: IN. The outputs are represented by the integer
array: OUT. Each digital input or output is treated as one binary bit. The low voltage level
corresponds to zero and high voltage level corresponds to one. Each element of the IN and
OUT arrays is a 32-bit integer number that can represent up to 32 inputs or outputs. In all
current SPiiPlus models, the number of inputs and outputs is less than 32; therefore all actual
inputs and outputs are represented in IN0 and OUT0. All other elements of IN and OUT are
reserved for future extension. For the exact number of inputs/outputs see the specifications of
the controller model.
The following example shows an autoroutine that changes the state of output 5 once the state
of input 3 changes from 0 to 1.
8 Advanced Features
This chapter describes various advanced ACSPL+ programming features that are available to
you. Topics covered are:
Data Collection
Position Event Generation (PEG) and MARK
Sin-Cos Encoder Multiplier Configuration
Interrupts
Dynamic Braking
Constant Current Mode
Hall Sensor Commutation
Communicating with the SPiiPlus C Library
Communicating with Non-ACS Devices
TRIGGER Command
Dynamic TCP/IP Addressing
Non-Default Connections
Input Shaping
DRA Algorithm
BI-Quad Filter
8.1.1 DC Command
Description
The DC command is used for executing data collection.
Syntax
DC[/switch] [axis], array_name, #_of_samples, period, list_of_variables
STOPDC[/switch] [integer]
Where switch can be one or a combination of:
s Start data collection synchronously to a motion.
w Create the synchronous data collection, but do not start until a go command is issued.
w can only be used with the s switch.
t Temporal data collection: sampling period is calculated automatically according to
collection time.
c Start cyclic data collection (can be used with switches s and w).
Data collection started by the DC command without the s switch is called system data
collection.
Data collection started by the DC/s command is called axis data collection.
Data collection started by the DC/c command is called cyclic data collection.
Unlike the standard data collection that finishes when the collection array is full, cyclic
data collection does not self-terminate. Cyclic data collection uses the collection array as a
cyclic buffer and can continue to collect data indefinitely. When the array is full, each new
sample overwrites the oldest sample in the array. Cyclic data collection can only be
terminated by the STOPDC Command.
Arguments
axis Axis to which the data collection must be synchronized. The parameter is required
only for axis data collection (s switch).
array_name Array that stores collected data. The array must be previously defined as global,
integer or real. The array size must be compatible with the number of samples and
number of stored variables (see Section 8.1.4 - Understanding System Data
Collection).
#_of_samples The number of data samples to collect.
period Sampling period in milliseconds. Actual sampling period may differ from this
value, because the controller rounds it to an integer number of controller periods.
For example if you set the period to 3.3 milliseconds, the controller will round it
to 3 milliseconds. If switch t is included in the command, the parameter defines a
minimal period (see explanation of temporal data collection below).
list of variables Up to eight variable names, whose values are to be collected. Each variable can be
a scalar variable, or an element of an array. Both local and global variables can be
specified. Irrespective of the storage array type, any combination of integer and
real variables is allowed - the controller automatically executes type conversion if
required.
The minimum sampling period is 0.05 millisecond, which defines a sampling frequency of
20kHz.
The controller rounds the specified period to an integer number of minimal periods and restricts
it to the permitted range.
Note
Data collection is disabled when the SPiiPlus MMI Application Studio
Scope is operating.
When the controller executes the DC command, it starts a separate real-time data collection
process that progresses in parallel with ACSPL+ programs and motion execution. Each
sampling period the process latches the values of all specified variables and stores them in the
specified array. The process continues until the specified number of samples is stored, or the
command STOPDC is executed. After process termination the array contains a time series of
the specified variables that may then be used for data analysis.
This is shown in the following example:
global real DCA(2)(1000)
DC DCA, 990, 3, FPOS(0), FPOS(1)
In the first line, a matrix consisting of two columns and 1,000 lines is set up for data
collection
The second line starts the data collection of the Feedback Position values for axes 0 and 1.
990 samples are to be collected, with a period of three milliseconds. The first step of the
data collection stores the current value of FPOS0 in DCA(0)(0) and FPOS1 in DCA(1)(0).
The second step stores FPOS0 in DCA(0)(1) and FPOS0 in DCA(1)(1).
Each variable is stored in one line of the array. Therefore the first dimension of the array (the
number of lines) must be equal or greater than the number of variables. If the number of lines
is greater than the number of variables, the extra array lines remain unaffected by the data
collection. If only one variable is specified for data collection, a one-dimensional array is
allowed.
Each sample of data collection fills up one column of the array. Therefore the second dimension
of the array (number of columns) must be equal or greater than the requested number of
samples. If the number of columns is greater than the number of samples, the extra array
columns remain unaffected by the data collection. The following examples show incorrect
usages of the DC command.
The following DC command is not allowed because the number of variables exceeds the
number of array lines:
global int IA, IC(1000)
DC IC,1000, 1, IA, FPOS(0)
The following DC command is not allowed, because the number of required samples exceeds
the number of array columns:
global int IA, IC(1000)
DC IC,1001, 1, IA
If /s is not specified, the system data collection process starts immediately after executing the
dc command. Normally, data collection stops automatically after <number of samples> x
<period> milliseconds. If the STOPDC command executes while the data collection is in
progress, the data collection stops prematurely, and the remaining array columns remain
unaffected. To terminate system data collection, the STOPDC command must contain no
parameters.
Note
The variable S_DCN provides the number of samples stored during data
collection
The DC/s command synchronizes the data collection start to the motion of an axis, but is not
limited to collecting data only of that axis. Any parameter for any other axis may be specified
for data collection. For example, the command
global real Array(2)(5)
dc/s 0,Array,500,1,FPOS(0),FPOS(1)
synchronizes data collection to the start of motion of axis 0, but collects data on both axes 0 and
1.
Only one data collection process, started by the DC command, can execute at a time. The next
DC command can execute only after the data collection started by the previous DC command
finishes. However, data collection, initiated by the DC/s command, may progress in parallel
with the data collection initiated by the dc command. Moreover, several data collection
processes initiated by the DC/s command may progress in parallel, providing they refer to
different axes or axis groups. For example these two commands are executed serially:
DC/s 0, Array,500,1,FPOS(0)
DC/s 0, Array,500,1,FPOS(1)
While these commands are executed in parallel (unless the 0 and 1 axes belong to the same axis
group):
DC/s 0,Array,500,1,FPOS(0)
DC/s 1,Array,500,1,FPOS(1)
!SLAVE/p 1
!DC DC_DataAsync,
wait 1000000
PTP/re X, 10
STOPDC
It should be noted that the syntax of STOPDC that terminates synchronous data collection has
been changed. If your application uses synchronous data collection, slight changes may be
Note
For details of the structure of PEG engines in NT systems, see SPiiPlus NT
PEG and MARK Operations Application Notes.
The SPiiPlus EtherCAT-based motion controllers provide the user with up to 6 identical PEG
engine units. Each PEG engine can operate in one of the following two modes:
Incremental PEG mode - provides the ability to generate a fix width pulse whenever a
fixed position interval has passed, starting at a predefined start point and ending at a
predefined end point
Random PEG mode - provides the ability to control a PEG pulse and a four-bit vector at
pre-defined positions, which are stored as a 256/1024 member user-defined array
Note
1024 member user-defined array is supported by CMba-x-320/CMhp-x-320
and UDMba-x-320/UDMhp-x-320 units only.
Each PEG engine can generate 1 PEG pulse: PEGx_PULSE (both in Incremental and Random
modes) signal and 4 state signals: PEGx_STATEy - a 4-bit output vector, on each random
position PEG event. State signals are set to a defined logical level or set to generate a pulse on
transition, as defined by a 256/1024 member PEGx_STATE_ARRAY integer array.
The PEG engines can be configured to be triggered by a position of any of the controller
Encoders, with certain restrictions that result from the board’s architecture.
The PEG engine outputs can be assigned to 10 physical interface outputs and the PEG pulse
width and polarity are programmable.
TILL AST(AXIS0).#PEGREADY
TILL AST(AXIS1).#PEGREADY
TILL AST(AXIS2).#PEGREADY
8.2.4 ASSIGNPEG
The ASSIGNPEG function is used for engine-to-encoder assignment as well as for the
additional digital outputs assignment for use as PEG pulse outputs. The parameters are different
from the original SPiiPlus definitions.
Syntax
ASSIGNPEG axis, engines_to_encoders_code, gp_out_assign_code
Arguments
axis Any axis designators of the same unit.
engines_to_encoders_ Bit code for engines-to-encoders mapping according to Table 13 and
code Table 14 for SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x, Table 15
for SPiiPlus CMnt-x-320/UDMpm-x-320/UDMpc-x-048/CMba-x-
320/CMhp-x-320/UDMba-x-320/UDMhp-x-320/UDMnt-x-A/B/C, or
Table 16 for SPiiPlusUDMlc-x-048/UDIlt-x/UDIhp-x.
gp_out_assign_code General Purpose outputs assignment to use as PEG pulse outputs
according to Table 17 and Table 18 for SPiiPlusNT/DC-LT/HP/LDx/
SPiiPlus SAnt-x, Table 19 for CMnt-2-x-320/UDMpm-x-320 units, or
Table 20 for UDMnt-x-A/B/C units.
Note
The axis parameter actually serves for determining which Servo Processor
is used.
Table 15 CMnt-x-320/UDMpm-x-320/UDMpc-x-048/CMba-x-320/CMhp-x-320/
UDMba-x-320/UDMhp-x-320/UDMnt-x-A/B/C Mapping PEG Engines to
Encoders (Servo Processor 0)
Bit Code Servo Processor 0
Encoder 0(X) Encoder 1(Y) Encoder 2(A) Encoder 3(B)
000 (default) PEG0 PEG1 PEG23
001 PEG0 PEG1 no PEG21, 3
010 PEG0 PEG1 no
PEG23
011 PEG0 PEG1 no
PEG23
100 PEG0 no no
PEG1
PEG23
101 no PEG0 no
PEG1
PEG23
110 PEG02, 3
PEG12, 3
PEG22, 3
111 PEG02, 3 PEG11, 3
PEG22, 3
1
These combinations are supported by CMnt-x-320/UDMpm-x-320 only.
2
These combinations are not supported by UDMpc-x-048.
3
These combinations are not supported by UDMnt-x-A/B/C.
Note that in Table 13, Table 14 and Table 15 the Bit Code affects all of the connectors in the
row. For example, the Bit Code: 001 for an axis associated with Servo Processor 0 performs
the following assignments:
PEG0 Encoder 0
PEG1 Encoder 1
PEG2 Encoder 3
Or for CMnt-x-320/UDMpm-x-320:
PEG0 Encoder 0(X)
PEG1 Encoder 1(A)
For an axis associated with Servo Processor 1 it performs the following assignments:
PEG4 Encoder 4
PEG5 Encoder 5
PEG6 Encoder 7
Note that in Table 17, Table 18, Table 19 and Table 20 the Bit Code affects the entire row.
For example, for an axis associated with Servo Processor 0, 0110 switches GP Out 0 to
PEG0_PULSE and GP Out 2 to PEG1_PULSE.
The same Bit Code applied to an axis associated with Servo Processor 1 switches GP Out 4 to
PEG4_PULSE and GP Out 6 to PEG5_PULSE.
All other GP Out assignments are unchanged.
Comments
ASSIGNPEG is a blocking command in the sense that the ACSPL+ progam moves to the next
line or command only after this command has been fully executed or an error is generated.
The axis parameter can be any of the axes controlled by the same servo processor, the result
will be the same.
8.2.5 ASSIGNPOUTS
Description
The ASSIGNPOUTS function is used for setting Fast General Purpose output pins assignment
and mapping between FGP_OUT signals to the bits of the ACSPL+ OUT(x) variable, where
x is the index that has been assigned to the controller in the network during System
Configuration.
Note
The assignments can be obtained by running #SI in the SPiiPlus MMI
Appication Studio Communication Terminal. For example, the following
is a fragment from the response to this command:
Axes Assignment: 8,9,10,11
Inputs/Outputs Assignment:
Digital inputs (IN): 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7
Digital outputs (OUT): 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7
OUT is an integer array that can be used for reading or writing the current state of the General
Purpose outputs - see SPiiPlus ACSPL+ Command & Variable Reference Guide.
Each PEG engine has 1 PEG pulse output and 4 state outputs for a total of 5 outputs per PEG
engine and a total of 30 outputs for the whole PEG generator. The controller supports 10
physical output pins that can be assigned to the PEG generator. The user defines which 10
outputs (of the 30) of the PEG generator are assigned to the 10 available physical output pins.
Some of the output pins are shared between the PEG and the HSSI.
The tables below define how each of the 30 outputs of the 6 PEG engines can be routed to the
10 physical output pins - 4 PEG out signals, 3 PEG state signals, and 3 HSSI signals. It needs
to be noted that some of the signals cannot be routed to the physical pins.
Syntax
ASSIGNPOUTS axis, output_index, bit_code
Arguments
axis Any axis designators of the same unit.
Starting from Version 2.15, axis parameter can be any axis number of the same unit.
output_index 0 for OUT_0, 1 for OUT_1, ..., 9 for OUT_9
bit_code Bit code for engine outputs to physical outputs mapping according to Table 21 and
Table 22 for SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x, Table 23 and
Table 24 for CMnt-x-320/UDMpm-x-320/UDMpc-x-048, and Table 25, Table 26
for CMba-x-320/CMhp-x-320/UDMba-x-320/UDMhp-x-320, and Table 27 for
UDMnt-x-A/B/C.
Note
For Bit Codes 101 and 110, the OUT_0 (X_PEG) and OUT_1 (Y_PEG)
mappings are supported for default PEG pulse polarity only.
The Bit Code: 111, both for Servo Processor 0 and Servo Processor 1, is used for switching the
physical output pins to Fast General Purpose Outputs: FGP_OUT0 to FGP_OUT6. The state
of the Fast General Purpose Outputs can be read or changed using the ACSPL+ OUT(x)
variable. The Fast General Purpose Outputs are mapped as follows:
FGP_OUT0 is mapped to bit 16 of the ACSPL+ OUT(x) variable
FGP_OUT1 is mapped to bit 17 of the ACSPL+ OUT(x) variable
FGP_OUT2 is mapped to bit 18 of the ACSPL+ OUT(x) variable
FGP_OUT3 is mapped to bit 19 of the ACSPL+ OUT(x) variable
FGP_OUT4 is mapped to bit 20 of the ACSPL+ OUT(x) variable
FGP_OUT5 is mapped to bit 21 of the ACSPL+ OUT(x) variable
FGP_OUT6 is mapped to bit 22 of the ACSPL+ OUT(x) variable
Comments
ASSIGNPOUTS is a blocking command in the sense that the ACSPL+ progam moves to the
next line or command only after this command has been fully executed or an error is generated.
Examples
The following examples illustrate using the ASSIGNPOUTS in order to use PEG outputs as
GP outputs
Example 1:
ASSIGNPOUTS 0, 2, 0b111
This defines the Z_PEG output as FGP_OUT2 and maps it to the bit 18 of the ACSPL+ OUT
variable (see Table 21).
If you run, for example,
OUT(x).18 = 1
Where x is the index assigned to the controller during System Configuration, FGP_OUT2
output will be activated.
Then if you run:
OUT(x).18 = 0
This defines the X_STATE2 output as FGP_OUT6 and maps it to the bit 22 of the ACSPL+
OUT variable (see Table 22).
Note
A separate command should be set for every GP output.
8.2.6 STARTPEG
Description
The STARTPEG command initiates the PEG process on the specified axis. The command is
used in both the Incremental and Random PEG modes.
Syntax
STARTPEG axis
Arguments
axis Any axis designators of the same unit.
Comments
STARTPEG is a blocking command in the sense that the ACSPL+ program moves to the next
line or command only after this command has been fully executed or an error is generated.
8.2.7 STOPPEG
Description
The STOPPEG command terminates the PEG process immediately on the specified axis. The
command is used in both the Incremental and Random PEG modes.
Syntax
STOPPEG axis
Arguments
axis Any axis designators of the same unit.
Comments
STOPPEG is a blocking command in the sense that the ACSPL+ program moves to the next
line or command only after this command has been fully executed or an error is generated.
8.2.8 PEG_I
Description
The PEG_I command is used for setting the parameters for the Incremental PEG mode.
Syntax
PEG_I [/wi] axis, width, first_point, interval, last_point
Arguments
axis Any axis designators of the same unit.
width Width of the Pulse.
first_point First point for the PEG generation.
interval The distance between PEG events.
last_point Last point for PEG generation.
Comments
If the switch: /w is included, the execution of the command is delayed until the execution of the
STARTPEG command.
If the switch: /i is included, the PEG pulse output signal is inverted.
The parameters that can be set by the command are identical to those that can be set for
SPiiPlusCM/SPiiPlusSA/SPiiPlus 3U controllers except for time-based-pulses and time-based-
period the setting of which is not supported.
Example
In this example PEG pulses are fired on axis 6 based on axis encoder 7.
GLOBAL AXIS6
GLOBAL AXIS7
AXIS6=6 ! Axis assignment
AXIS7=7
ST:
peg_i AXIS6,0.5,-100,-200,-10000
TILL AST(AXIS6).#PEGREADY
!Wait till command executes and configuration is set, in order to ensure
!proper PEG engine's execution prior to start of movement
ptp/e AXIS6,-12000
stoppeg AXIS6 ! Prevent PEG pulses' firing on the 'way back'
ptp/e AXIS6,0
goto ST
stop
8.2.9 PEG_R
Description
The PEG_R command is used for setting the parameters for the Random PEG mode.
Syntax
PEG_R [/wi] axis, width, mode, first_index, last_index, POS_ARRAY, STATE_ARRAY
Arguments
axis Any axis designators of the same unit.
width Width of the Pulse.
mode PEG state output signals configuration according to Table 28.
Bits 0-3 relates the PEG State 0 of the specific PEG engine
Bits 4-7 relates the PEG State 1 of the specific PEG engine
Bits 8-11 relates the PEG State 2 of the specific PEG engine
Bits 12-15 relates the PEG State 3 of the specific PEG engine
The most commonly used value is 0x4444 - PEG State Outputs 0-3 are
configured with the ‘State” option (bits 2, 6, 10, 14 are ON).
first_index Index of first entry in the array for PEG generation
last_index Index of last entry in the array for PEG generation
POS_ARRAY The Random Event Positions array, maximum of 256/1024 members
STATE_ARRAY The Outputs States array defining the four PEG output states, maximum
of 256/1024 members
Pulse Polarity:
If positive or negative pulse is used as PEG pulse value for the specific “PEG State Output”
State Polarity:
If positive or negative state is used as PEG pulse value for the specific “PEG State Output”
Comments
If the switch: /w is included, the execution of the command is delayed until the execution of the
STARTPEG command.
If the switch: /i is included, the PEG pulse output signal is inverted.
The parameters that can be set by the command differ from those that could be set for
SPiiPlusCM/SPiiPlusSA/SPiiPlus 3U controllers with the addition of the new first_index and
last_index parameters. The setting of parameters: time-based-pulses and time-based-period,
however, which could be set for SPiiPlusCM/SPiiPlusSA/SPiiPlus 3U controllers is not
supported.
Example
In this example PEG pulses are fired on axes 0, 1, and 2 according to encoder of axis 0.
GLOBAL AXIS0
GLOBAL AXIS1
GLOBAL AXIS2
AXIS0=0
AXIS1=1
AXIS2=2
assignpouts AXIS0, 0, 0b000 !Assign bit code 000 from Table 21 to AXIS0,
!at Pin0
assignpouts AXIS1, 1, 0b000
assignpouts AXIS2, 2, 0b001
ST:
peg_r AXIS0,0.5,0x4444,0,15,ARR,STAT !Activate random PEG for axis 0
peg_r AXIS1,0.5,0x4444,0,15,ARR,STAT
peg_r AXIS2,0.5,0x4444,0,15,ARR,STAT
ptp/e AXIS0,5000
stoppeg AXIS0 ! Prevent PEG pulses' firing on the 'way back'
ptp/e AXIS0,0
goto ST
stop
8.2.10 ASSIGNMARK
Description
The ASSIGNMARK function is used for Mark inputs-to-encoder assignment. It allows
mapping available physical Mark inputs pins to different encoders..
Syntax
assignmark axis, mark_type, inputs_to_encoder_bit_code
Arguments
Axis Axis index
Note In Table 29 and Table 30, the Bit code affects all of the inputs in the row.
For example, Bit code: 00010 performs the following assignments for these
inputs:
Mark-1 4(Z)—Encoder 0(X)
Mark-1 5(T)—Encoder 1(Y)
Mark-1 0(X)—Encoder 4(Z)
Mark-1 1(Y)—Encoder 5(T)
Table 31 Mark-1 and Mark-2 Inputs to Encoders Mapping for for CMnt-x-320/
UDMpm-x-320/UDMpc-x-048/CMba-x-320/CMhp-x-320/UDMba-x-320/
UDMhp-x-320 Units
Bit Encoder 0(X) Encoder 1(Y) Encoder 2(A) Encoder 3(B)
code Mark-1 Mark-2 Mark-1 Mark-2 Mark-1 Mark-2 Mark-1 Mark-2
Input Input Input Input Input Input Input Input
000 Mark-1 Mark-2 Mark-1 Mark-2 Mark-1 GP IN6 Mark-1 GP IN7
(deafult) 0(X) 0(X) 1(Y) 1(Y) 0(X) 1(Y)
001 GP IN6 Mark-1 Mark-1 Mark-1 Mark-2 Mark-1 Mark-1 Mark-1
1(Y) 0(X) 1(Y) 0(X) 1(Y) 0(X) 1(Y)
010 - Mark-2 GP IN4 GP IN5 GP IN6 Mark-2 GP IN6 -
1(Y) 1(Y)
011 - GP IN7 GP IN6 GP IN7 - GP IN7 - -
8.2.11 ASSIGNFINS
Description
The ASSIGNFINS function is used for setting input pins assignment and mapping between
FGP_IN signals to the bits of the IN variable.
Note The axis and input/output assignments of a unit can be obtained by running
#SI in the SPiiPlus MMI Appication Studio Communication Terminal. For
example, the following is a fragment from the response to this command:
Axes Assignment: 0,1,2,3,4,5,6,7
Inputs/Outputs Assignment:
Digital inputs (IN): 0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7
Digital outputs (OUT): 0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7
Analog inputs (AIN): 0,1,2,3
Analog outputs (AOUT): 0,1,2,3
HSSI channels: 4
Ext. inputs (EXTIN): 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Ext. outputs (EXTOUT): 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Syntax
ASSIGNFINS axis, input_index, bit_code
Arguments
axis Any axis number of the same unit.
bit_code Bit code for mapping engines inputs to physical inputs according to Table 32 and
Table 33 for SPiiPlusNT/DC-LT/HP/LD-x/SPiiPlus SAnt-x, Table 34 for
SPiiPlus CMnt-x-320/UDMpm-x-320/UDMpc-x-048/CMba-x-320/CMhp-x-
320/UDMba-x-320/UDMhp-x-320 units, and Table 35 for UDMlc-x-
048/UDIlt-x/UDIhp-x/UDMnt-x-A/B/C.
Table 34 CMnt-x-320/UDMpm-x-320/UDMpc-x-048/CMba-x-320/CMhp-x-320/
UDMba-x-320/UDMhp-x-320 Mapping of Engine Inputs to Physical
Inputs (Servo Processor 0)
Bit Code IN_3 IN_2 IN_1 IN_0
MARK-1 Y MARK-1 X
000 None None None None
(default)
111 Reserved Reserved FGP_IN1 FGP_IN0
Note The Bit Code: 111, both for Servo Processor 0 and Servo Processor 1, is
used for switching the physical input pins to Fast General Purpose Inputs:
FGP_IN0 to FGP_IN3. The state of the Fast General Purpose Inputs can be
read or changed using the ACSPL+ IN(x) variable. The Fast General
Purpose Inputs are mapped as follows:
FGP_IN0 is mapped to bit 16 of the IN(x) variable
FGP_IN1 is mapped to bit 17 of the IN(x) variable
FGP_IN2 is mapped to bit 18 of the IN(x) variable
FGP_IN3 is mapped to bit 19 of the IN(x) variable
All other physical input pins are unaffected. Bit Codes 001-110 are not used.
Comments
ASSIGNFINS is a blocking command in the sense that the ACSPL+ program moves to the next
line or command only after this command has been fully executed or an error is generated.
1/(250*1024) = 0.00000390625
Encoder-related features: index, Mark, PEG use the same user unit. However, actual resolution
of these functions is lower than the resolution of encoder feedback. As mentioned above, the
resolution of index, mark and PEG corresponds to 4 counts per encoder sine period. In the
former example the resolution will be 1/(250*4) = 0.001mm.
The controller continuously checks the integrity of the encoder multiplier feedback. If any error
occurs, the controller activates the Encoder Error fault.
8.4 Interrupts
Typically, you work with the SPiiPlus interrupts using the SPiiPlus C Library and do not need
the low-level details specified in this section. Refer to the SPiiPlus C Library Reference
document for explanation of the interrupt managing functions.
When a software interrupt occurs, the corresponding tag contains detailed information about the
interrupt source. For example, the tag of the Physical Motion End interrupt specifies the axes
that caused the interrupt. When a specific software interrupt has occurred, the next interrupt of
the same type can be generated only after the host drive reads both interrupt status register and
writes zero to the corresponding tag.
Only once these conditions are true can the constant current mode be enabled by the function
SETCONF (133, 1, 1). If any of the conditions is changed, it will deactivate the constant
current mode.
To set/get the current level used for constant current mode, the following
SETCONF/GETCONF parameters are used:
SETCONF (130, {1|5}, current level), where current level defines that the constant
current level as a percentage of the maximum current for the specified axis (1 or 5 only).
The default maximum value that can be set is 16% for axis 1 and 30% for axis 5 (this value
can be changed, see description of key 131 below).
GETCONF (130, {1|5}) retrieves the present value of current level for the specified axis.
The default value of current level is 0, so it must be defined before constant current mode can
be used.
To set/get the maximum value that can be set with SETCONF (130, . . .), the following
SETCONF/GETCONF parameters are used:
SETCONF (131, {1|5}, max_current_level), where max_current_level defines the
maximum allowable value of the current level as a percentage of the maximum current for
the specified axis (1 or 5 only).
GETCONF (131, {1|5}) retrieves the present maximum allowable current level for the
specified axis.
The following ACSPL+ program illustrates how to implement constant current mode:
! Constant current mode implementation
on S_FAULT.#ES
disableall
wait 100
MFLAGS(1).#BRAKE = 0; MFLAGS(5).#BRAKE = 0 !Disable Brake Mode for
!axes 1, 5
setconf(130, 1, 10) ! set constant current level (10%) for axis 1
setconf(130, 5, 20) ! set constant current level (20%) for axis 5
setconf(133, 1, 1) ! enable constant current mode
ret
on ^S_FAULT.#ES | S_FAULT.#DRIVE
setconf(133, 1, 0) ! disable constant current mode
ret
The connection sequence of the three Hall sensors is not important. Simply verify that the
three sensors are connected, and that the Hall counter counts 0,1,2,3,4,5. It does not matter
if the Hall counters count is opposite of the encoder. This situation is identified and dealt
with during the initial adjustment.
Table 36 lists the variables and functions for supporting Hall operations
Note
1. After hardware reset, if the Hall commutation was successful, the
firmware automatically sets bit MFLAGS.9 = 1, if MFLAGS.27 = 1.
2. For proper Hall commutation, the encoder resolution and number of
poles should be defined correctly. The current loop should be adjusted.
The Callback mechanism provides the fastest response to the controller events. The
implementation is transparent for user applications. In all communication channels, the
callback API consists of the functions, SetCallback and SetCallbackExt.
8.8.2.1 Timing
Callback operations include sending/receiving a message that requires much more time.
Specific rates depend on the communication channel rate.
From the viewpoint of callback mechanism, all communication channels are functionally
equivalent, but differ in timing.
The following interrupts are generated by the controller firmware and therefore are called
software interrupts:
Physical motion end
Logical motion end
Motion failure (Motion interruption due to a fault)
Motor failure (Motor disable due to a fault)
Program termination
Command execution
ACSPL+ interrupt (by INTERRUPT command)
Digital input
Logical motion start
Motion phase change
Trigger
Note
For a description of all the UMD functions see SPiiPlus Utilities User
Guide.
To establish a remote connection using TCP/IP, select Enable Access from Remote
Application on the User Mode Driver (UMD) Remote Connection tab.
If the default port is not busy, no communication error messages are encountered, and no
problem is anticipated. In this case, use the function acsc_SetServerExt with the
ACSC_DEFAULT_REMOTE_PORT parameter to set the remote port address from the user
application.
If the default port (9999) is busy, the UMD will return the following error message:
Requested port 9999 is in use by another application. Select another port in the Remote
Connection tab.
In this case, proceed as follows:
1. From the Remote Connection tab, select Change from the Remote Port Connection list.
2. Enter the remote port address in the Enter valid port number dialog.
3. From the Remote Connection tab, select Enable Access from Remote Application. As
soon as the check box is selected, communication with the remote port is attempted. If
communication does not succeed, the following error message appears:
Requested port [port number] is in use by another application. Select another port in the
Remote Connection tab.
4. Repeat Steps 1-3 until communications are established. When communications are
successfully established, the UMD stores the settings.
5. Click OK and then Close.
6. In the user application, use the function acsc_SetServerExt and specify the same port
number that was entered in the UMD GUI.
Note
Every time the User Mode Driver (UMD) initializes, the availability of the
specified port is checked. If the system configuration or port number have
changed, the UMD generates an error message and the Enable Access from
Remote Application on the UMD Remote Connection tab check box will be
cleared.
Note
The Infinite setting is not recommended because of a possible disk overflow
situation.
Another use of the SETCONF and GETCONF functions (see SPiiPlus Command & Variable
Reference Guide) relates to external communication channels. The functions are used to
facilitate the following tasks:
Connection to user panel (teach pendant, console) that make use of special communication
protocols (Modbus, etc.)
Connection to devices with special interfaces (laser interferometer, intelligent drives, etc.)
Note
Currently only serial channels can be connected to devices such as these. All
functions described below are implemented for RS232 serial channels only.
Note
For any specific hardware configuration, not all listed channels may be
physically available.
The SETCONF function with key 302 assigns a communication channel for special input as
follows:
SETCONF(302, channel, {0|1})
Where:
channel Indicates the assigned COM channel, it can be one of the following values:
1 – COM1
2 – COM2
The values that can be used in connection with the channel are:
1 – assigns the channel for special input
0 – returns the channel to regular command processing.
If a channel is assigned for special input, the controller does not process commands from this
channel. Any input from this channel can be processed only by the inp function (see
Section 8.9.4 - INP Function). Output to the channel is provided by regular DISP and SEND
commands (see SPiiPlus Command & Variable Reference Guide).
Note
While a channel can be set to special communication mode by the
SETCONF command through the same communication channel, the
channel cannot be returned to normal mode through the same channel. The
reason is that in special communication mode the channel does not process
commands and therefore cannot execute SETCONF. You have to use
another channel to return the channel to the regular command processing
mode
The getconf function with key 302 retrieves the state of a communication channel as follows:
getconf(302, channel)
The function returns:
Where:
channel Indicates the assigned COM channel, it can be one of the following values:
1 – COM1
2 – COM2
baud Specifies the communication rate in the channel.
The function GETCONF with key 303 retrieves the communication rate of the specified
channel as follows:
GETCONF(303, channel)
If an input string argument contains n format specifiers, the specifiers apply to the n subsequent
expression arguments.
The DISP command processes the arguments from left to right. The processing is as follows:
Expressions:
The expression is evaluated and the ASCII representation of the result is placed in the
output string. The format of the result is determined by a formatting specification (if any)
in the input string.
Input strings:
Text is sent as-is to the output string. Escape sequences are replaced by the ASCII codes
that they represent. Formatting specifications are applied to the results of any expressions
that follow the string.
Examples:
DISP "%15.10f",FPOS(0) Display value of FPOS(0) in 15 positions with 10 digits
after the decimal point
DISP "%1i",IN0.2 Display current state of IN0.2 as one digit 0 or 1.
DISP "FVEL(0)=%15.10f",FVEL(0) Display value FVEL(0) with 10 decimal points, e.g.,
displayed output is: FVEL(0)= 997.2936183303
DISP "IN0 as hex: %04X",IN0 Display value of IN0 in hex, e.g., displayed output is: IN0
as hex: 0A1D
disp "IN0.0-3 as binary: Display values of bits 0-3 of IN0 as binary, e.g., displayed
%1U%1u%1u%1u", output is: IN0.0-3 as binary: 0110
IN0.0,IN0.1,IN0.2,IN0.3
The output string is sent to a communication channel. The channel is specified by the current
value of standard DISPCH (default channel) variable. The following values are available:
1– Serial communication channel COM1.
2– Serial communication channel COM2.
6– Ethernet network (TCP).
7– Ethernet network (TCP).
8– Ethernet network (TCP).
9– Ethernet network (TCP).
10 – Ethernet Point-to-Point network. (UDP)
-1 – No default channel is specified, the DISP command uses the last channel activated
by the host.
-2 – All channels.
In order to receive unsolicited messages by a host application, perform the following:
1. Set DISPCH to -2.
2. Set bit 4 of COMMFL to 1.
3. Send SETCONF(306,-1,1) from the same communication channel where unsolicited
messages are expected to be received.
In order to stop the receipt of unsolicited messages by a host application:
Send SETCONF(306,-1,0) from the same communication channel where there is no need any
more to receive unsolicited messages.
disp-arguments are the same as those detailed for the DISP command (see Section 8.9.5.1 -
DISP Command).
channel defined by the DISPCH variable (see SPiiPlus Command & Variable Reference
Guide). Results of the SEND command are sent to the communication channel defined by
the communication channel argument (channel-number).
Return value
The function returns a string composed of the array elements interpreted as characters.
Comments
Each element of the variable array is interpreted as an ASCII character. If an element value is
in the range from 0 to 255, it is directly converted to the corresponding ASCII character.
Otherwise, the value’s modulo 256 is converted.
If neither start_index nor number is specified, the conversion takes all elements of the array.
If only start_index is specified, the conversion takes all characters from the specified index to
the end of array. Specifying number limits the number of characters in the resulting string.
The function can be used within the SEND or the DISP command.
Example
The following example provides a mirror for channel 2, so that any received character is sent
back:
int Char(1)
INP(2,Char,,1)
SEND 2,str(Char)
Arguments
string String of characters enclosed in double quotation marks
variable Name of user-defined integer array.
start_index Index of the array.
number Specifies number of characters.
Return value
The function returns the number of actually assigned characters.
Comments
The function decomposes string into individual characters and assigns the characters to the
sequential elements of the variable array.
Each ASCII character is represented as its numerical value and stored in a separate element of
the array.
If start_index is specified, the first character is assigned to the array element with the specified
index. If start_index is omitted, the assignment starts from the first element of the array.
If number is omitted, the function assigns all characters of the string. If number is specified,
the function assigns the specified number of characters. In both cases the assignment stops
when the last array element is reached.
Comments
One TRIGGER command can cause triggering many times. The controller continues
calculating the expression until another TRIGGER command is executed in the same channel.
Each time when the expression changes its value from zero to non-zero, the controller raises the
trigger bit and produces the interrupt.
The following table specifies triggering bit and interrupt tag for each triggering channel:
• After start-up, use SETCONF with a non-zero address argument to assign an actual
address to the controller.
This approach makes sense, if the controller is assigned with an address dependent on some
condition available only at run time. For example, the controller may select its TCP/IP
address on the basis of digital input states.
3. Dynamic Addressing
• Configure a zero TCP/IP address in the TCPIP variable and store it in the flash.
• After start-up, the controller initiates DHCP communication with the DHCP server and
obtains the TCP/IP address and other network information.
To use this method, the DHCP server should be accessible at the time of controller start-up.
If the DHCP server is not accessible, the controller repeats the request several times. If all
attempts fail, the controller disables Ethernet channel support and continues initialization.
4. Delayed Dynamic Addressing
Use this method, if the DHCP server is not available at the time of controller start-up. It
may occur, for example, if the controller and the computer running DHCP server are
activated at the same time, and nobody knows which is ready first.
• Configure zero TCP/IP address in the TCPIP variable and store it in the flash.
• Create an initialization routine in one of the buffers, and store it in the flash:
AUTOEXEC:
WHILE GETCONF(310,0) = 0
SETCONF(310,0,0)
END
! continue initialization
As a result, the controller waits at the beginning of initialization until the DHCP server
succeeds to in supplying a TCP/IP address.
Note
It should be noted that many applications require switching between non-
default or default connections within the process of operations. You can
return to a default connection by setting the MFLAGS.#DEFCON (bit 17,
Default Connection) to 1. This automatically resets the connect formula,
updates dependence and equates corresponding APOS to RPOS (see
Chapter 7 - Connection to the Plant).
The controller recalculates the offset to prevent motor jump when any of the following
commands is executed:
CONNECT
SET
ENABLE
DISABLE
KILL
ROFFS reads the current value of the offset. Watching the offset value facilitates development
and debugging of application with complex kinematics.
DAPOS reads the same values of axis position, but synchronously with RPOS and FPOS.
Using synchronous axis position facilitates analysis and debugging of the CONNECT formula.
Use only DAPOS for watching the axis position in the Scope.
Note
The CONNECT command cannot be executed as long as the default
connection bit (MFLAGS.#DEFCON) is raised.
Syntax:
CONNECT RPOS(axis) = expression
Where RPOS(axis) is an axis RPOS variable (for example, RPOS(0)), which receives the
value of the expression.
For more information about RPOS and other common motion variables refer to the SPiiPlus
Command & Variable Reference Guide.
The connect command is not an assignment command (see Section 3.8.1 - Assignment
Command). It does not simply assign the result of the formula on the right side to the axis
RPOS. The formula is not evaluated when the connect command is executed (which would be
the case for an assignment command); instead, the formula is stored and then evaluated by the
controller every controller cycle to calculate the corresponding RPOS.
After power-up the controller always starts with the default connection. The default connection
means the following for each axis:
Bit MFLAGS.#DEFCON is raised.
The default connect formula is defined as connect RPOS = APOS.
APOS and RPOS are linked, i.e., explicit (through the set command see Section 4.1.5 -
SET Command) or implicit change of one of these variables causes the same change in
the other one.
Once an application resets MFLAGS.#DEFCON, it can then execute a connect and (typically)
a DEPENDS command. At this point, the motor is considered to be in non-default connection.
Consider the following examples:
The commands
MFLAGS(1).#DEFCON = 0
CONNECT RPOS(1) = APOS(0)
DEPENDS 1, 0
connect the 1 axis motor position to the 0 axis reference. If the 0 axis motor is also connected
to the 0 axis reference, this provides gantry-like motion of two motors.
The command
PTP 0, 1000
The command:
connect RPOS(0) = APOS(0) + AIN(1)
connects the 0 axis motor position to the 0 axis reference plus analog input 1. In this case the 0
axis provides a motion and the analog input (for example, an external sensor) supplies a
correction for the 0 axis motor.
The following commands
MFLAGS(2).#DEFCON = 0
connect RPOS(2) = APOS(2) + APOS(3)
depends 2, (2,3)
connect the 2 axis motor to the sum of 2 and 3 axes. The axes can each execute an independent
motion, with the 2 axis motor following the sum of the two motions. Or the axes can participate
in a single multi-axis motion.
The following illustrate uses of the connect command.
Note
The connect command is normally followed by a depends command (see
Section 8.12.4 - DEPENDS Command).
A more sophisticated application may require changing the connection in the middle of
operations. The controller applies no limitations regarding when a connection can be
changed. In a typical case, changing connection requires three commands:
CONNECT RPOS(0)=… Specify connection of 0 axis motor.
DEPENDS 0,… Specify dependence of 0 axis motor.
SET APOS(0)=…,RPOS(0)=… Set origin of 0 axis and 0 axis motor.
and
CONNECT RPOS(0) = 0.5*APOS(0) + 2000
Note
The DEPENDS command cannot be executed as long as the default
connection bit (MFLAGS.#DEFCON) is raised.
Syntax
DEPENDS dependent_axis, axes_specification
Comments
The dependent_axis argument specifies an axis and the axes_specification argument specifies
one or more axes on which the motor depends.
Typically, a DEPENDS command will follow a CONNECT command. Whereas a
CONNECT command can define a mathematical correspondence between a motor’s reference
position (RPOS) and one or more axis positions (APOS), a DEPENDS command specifies the
logical dependence between a motor and axes.
The DEPENDS command is necessary because generally the controller is not capable of
deriving the dependence information from the CONNECT formula alone. For this reason, once
a CONNECT command is executed, the controller resets the dependence information of the
motor; the motor depends only on the corresponding axis.
Dependence information, as specified using a DEPENDS command, is required in the
following cases. If the dependence information is not provided correctly, the controller may
display strange behavior.
A motor/axis query (for example, ?0) returns the non-default dependence for that motor.
When initiating a motion, the controller verifies if each motor dependent on the axes
involved is enabled. If one or more motors are disabled, the motion does not start.
If in the process of motion a motor is disabled or killed due to a fault or due to a DISABLE
or KILL command, the controller immediately terminates all motions involving the axes
that the motor depends on.
Once a SET APOS=… command is executed, the controller adjusts offsets in the
connection formula of the motors that depend on the specified axis.
Comments
The function is useful in the case of non-default connections if a motor depends only on the
same axis, a typical example is error compensation. For example, the following connection:
CONNECT RPOS(1) = APOS(1) + MAPBY1(APOS(1), ErrorTable)
DEPENDS 1,1
can be used to find matching APOS(1) in the range -1000 to +1000 and to set offset ROFFS1
to zero. In mathematical terms, the function finds the root of equation:
RPOS = F(x)
where RPOS is the current value of the RPOS variable and F(x) is the connect formula
specified by you with APOS substituted for x.
The function succeeds if the unique root exists in the specified range. If there are several roots
in the range, the function returns one of them. If the root does not exist, the function result is
incorrect. It is your responsibility to restrict the range so that the function provides proper result.
Comments
For correct calculation, the function must be called each controller cycle.
Vectors T_array and Amp_array define characteristics of the convolution pulses. If the vector
size is greater than NP, only the first NP elements are used for the function calculation.
Vector T_array contains real numbers, so fractional numbers can be specified. However, the
position of each pulse is rounded to a multiple of the controller cycle. If the controller cycle is
one millisecond, the numbers in T_array are rounded to integers.
The elements of T_array must be arranged in ascending order.
Buf is used for the internal calculation in the function. You do not need to fill the buffer before
the function call. The size of the vector must be not less than the maximum time of convolution
pulses divided by the controller cycle. As T_array elements are sorted in ascending order, the
condition can be expressed as:
Size(Buf) = T_array[NP-1]/CTIME+1
where CTIME is the controller cycle in milliseconds.
INSHAPE detects the following error conditions:
The size of vector T_array is less than NP.
The size of vector Amp_array is less than NP.
The size of Buf is not enough.
Note
You have to take a few precautions working with the axis that implements
input shaping:
1. Do not use KILL for the axis. Use HALT to terminate a motion.
2. Do not use a KILL response to the faults. Re-define any kill response to
a kill-disable response for the axis.
3. Execute any required set commands before input shaping is activated.
4. Use inshape in the CONNECT command for the required axis. Execute
CONNECT every time an axis is enabled.
Example
The following example illustrates implementation of input shaping for the 1 axis:
Note
Use the name and password that you received from ACS Motion Control
along with the controller.
The first time you log into the web site, you will be required to review the licensing agreement
for use of the site. For each subsequent log-in you will be reminded of the licensing agreement
and remaining number of trials until expiration of the account will be displayed.
The damped natural frequency will be less than the natural frequency by the factor,
2
1 – zeta
The frequencies are referred to as “measured frequencies” because the program performs
the calculations to convert them to “undamped natural frequencies”.
Hardware ID, Location, Tooling ID and Notes - These are optional fields that can be
used to document a configuration for a specific machine. Text entered into these fields is
copied into the output file as a comment.
Robust check box - This box should normally be selected to design a “robust” Input
Shaper™ for a range of ±15% of the nominal frequency. This box can be left unchecked
when the range of frequency variation is less than ±5%. Non-robust Input Shapers™ are
50% shorter in duration than a robust Input Shapers™. Please refer to the discussion on
Insensitivity Curves below for more information.
When all of the data has been entered, press the Calculate to start the calculation. It can take
several seconds to complete the calculation.
The results from the calculation can be saved directly by using the web browser file command
File Save as …. Save the results as a text file (*.txt), so Input Shaper™ coefficients can be
downloaded into a controller. The same file will sent by email to the email account specified
when the account was created.
Click the Curve option (shown in Figure 25) to display the useful frequency range for the Input
Shaper™. A new window, Figure 27, opens to display the Insensitivity Curve. The following
plot is the Insensitivity Curve for the example shown above:
The Insensitivity Curve displays the theoretical amount of residual vibration that results after
applying the Input Shaper™ to the system. The horizontal axis is the vibration frequency of the
system and the vertical axis is the percentage of remaining or residual vibration. When the
residual vibration = 0, for a perfect linear system, there should be no vibration after applying
the Input Shaper™. In the case shown above, the residual vibration should be 0 at a frequency
of 100 Hz, which was the design frequency.
If the frequency of the actual system is not equal to 100 Hz, there will be residual vibration
present. This level of vibration is expressed on a percentage basis. If the residual vibration
equals 100%, then the no vibration reduction has occurred. For the Input Shaper™ shown
above, the system vibration frequency could vary between 85 to 115 Hz and the residual
vibration should be less than 5% (or when compared to the case of not using the Input Shaper™,
the vibrations should be reduced by 95%).
Note
It should be remembered that the vibration reduction is expressed for a
“perfect” linear system. There are some examples of perfect, linear systems
in the real world that do achieve close to 100% cancellation. (One good
example of a “perfect” system is a simulation. Input Shaping usually
performs very well in simulation.) However for most physical systems, the
vibration reduction will usually be in the range of 95 to 98% of the original
vibrations.
The frequency range for the Insensitivity Curve can be changed by selecting new minimum
and maximum frequency values and then clicking New Curve. The damping ratio can also be
changed to determine the effect of changes in the estimated damping of the system. In general,
changes in damping in the range from 0.005 to 0.1 have a limited effect on the Insensitivity
Curve. When the system damping ratio is greater than 0.1, the effectiveness of the Input
Shaper™ will be improved by specifying a damping ratio that is close to that of the actual
system.
The Insensitivity Curve can also be used to examine the effect of selecting whether or not an
Input Shaper™ should be designed using the Robust selection. If Robust is not selected for a
particular frequency, the useful range of the Input Shaper™ will be reduced. For example the
following Insensitivity Curve, Figure 28, is for the same Input Shaper™ without Robust:
The most common use of the algorithm is to improve the settling of systems mounted on passive
isolation platforms. Passive isolation is typically used to isolate systems from disturbances
transmitted from the floor. They employ a seismic mass supported on a soft spring made of
rubber, metal, or air. The spring’s damping action absorbs vibrations above the spring’s
resonance. For this reason, passive isolation manufacturers usually try to lower spring resonant
frequency to increase the effective isolation range. When a servo force is applied to generate
motion, it also acts on the isolated stationary base, causing it to vibrate. Because the frequency
is low (usually below 1 Hz, to 10 Hz) and damping is very light, the isolation system continues
vibrating long after the motion profile has ended. This vibration acts as disturbance to the servo
system, introduces position error, and extends the settling time.
The Disturbance Rejection algorithm is used to minimize the latter effect and improve the
position error during settling. This is demonstrated in Figure 29 and Figure 30. The green
graph shows the velocity command (in [mm/sec]) of a linear stage mounted on passive
isolation, with a resonant frequency of approximately 5 Hz. The red graph shows the position
error with a standard PIV algorithm. The 5Hz disturbance is clearly observed during settling.
The disturbance is relatively small (less than 1 micron), yet it may be critical if the required
settling window is very small (as an example, the resolution of semiconductor instruments is
approaching and in some cases going below 1nm). This disturbance can be minimized by
increasing the PIV gains (SLVKP, SLVKI, SLPKP - see SPiiPlus ACSPL+ Command and
Variable Reference Guide), yet it cannot necessarily be eliminated and if the values of the PIV
gains are too high this may lead to marginal stability. A better solution is using the DRA
algorithm. As it can be seen in the blue graph the disturbance is fully eliminated.
If tuned properly the algorithm has minimal effect on the servo stability margins.
Note
DRA is usually not very effective if the vibration frequency is relatively high
(>10Hz), or the system bandwidth is very low.
Excessive values of SLRA, and SLDRX may cause servo instability, ringing and increased
standstill jitter. In such cases the parameters should be significantly reduced. With good
settings, you should usually be able to double the parameters without getting instability.
Velocity error (1 division = 0.02 mm/sec) during settling process of a linear axis. The maximal
value of the periodical error is used to determine the SLDRX parameter.
The Bi-Quad filter is the most general 2nd order filter. It has two poles and two zeros. It can be
thought of as a high-pass filter in series with a low-pass filter. The transfer function of the Bi-
Quad filter is as follows:
H (s)
s / N 2 2 N s / N 1
s / D 2 2 D s / D 1
Where:
N and D are the numerator (high-pass filter zero) and denominator (low-pass filter pole)
frequencies, respectively.
N and D are the numerator and denominator damping ratios, respectively.
The Bi-Quad filter can be used to compensate mechanical resonances, improve stability
margins and system bandwidth.
The Bi-Quad filter can be configured as an additional Notch using the following formulas:
Set the numerator and denominator frequencies equal to the Notch frequency in[Hz]:
SLVB 0 NF SLVB 0 DF SLVNFRQ [ Hz ]
Set the numerator damping ratio equal to half the ratio between the Notch width and Notch
frequency:
SLVNWID [ Hz ]
SLVB 0 ND
2 SLVNFRQ [ Hz ]
Below there are several examples that demonstrate the generality of the Bi-Quad filter.
Note
Encoder variables (E_TYPE, E_SCMUL, SCCOFFS, SCSOFFS,
SCGAIN, and SCPHASE) are connected to the encoder feedback, not an
axis; therefor they are unaffected by routing.
Note
All bits (except #INSYNC in some cases) should be true for proper bus
functioning, for monitoring the bus state, checking the #OP bit is sufficient.
Any bus error will reset the #OP bit.
9.2.1.2 ECERR
Any EtherCAT error sets ECST.#OP to false and the error code is latched in the ECERR
variable. The only way to reset the error state and to clear the ECERR value is by calling
ECRESTART function.
The EtherCAT error codes are detailed in Table 42.
9.2.2 #ETHERCAT
The #ETHERCAT command is available for gaining complete information about the connected
EtherCAT slaves: The command is entered through the SPiiPlus MMI Application Studio
Communication Terminal. The command provides the following:
Slave number
Vendor ID
Product ID
Revision
Serial number
EtherCAT physical address
DC support
Mailbox support
Following the display of the above general data, a list of network variables is displayed. Each
variable is described with:
Name (as in XML)
Offset inside the telegram (magic number that is used for mapping)
IN or OUT description
Data size
9.3.1.1 ECIN
Description:
The ECIN function is used for mapping input variables to the EtherCAT network.
Syntax:
ECIN(int offset, Varname)
Arguments:
offset Internal EtherCAT offset of network variable (which can be seen by running the
#ETHERCAT command).
Varname Valid name of ACSPL+ variable, global or standard.
Comments:
Once the function is called successfully, the Firmware copies the value of the network input
variable at the corresponding EtherCAT offset into the ACSPL+ variable, every controller
cycle.
There is no restriction on number of mapped network variables.
The mapping is allowed only when stack is operational, that is, ECST.#OP is true.
In the event of incorrect parameters or stack state, the function will produce the corresponding
runtime error.
9.3.1.2 ECOUT
Description:
The ECOUT function is used for mapping output variables to the EtherCAT network.
Syntax:
ECOUT(int offset, Varname)
Arguments:
offset Internal EtherCAT offset of network variable (which can be seen by running the
#ETHERCAT command).
Varname Valid name of ACSPL+ variable, global or standard.
Comments:
The Firmware copies the value of ACSPL+ variable into the network output variable at the
corresponding EtherCAT offset, every controller cycle.
There is no restriction on number of mapped network variables.
The mapping is allowed only when stack is operational, that is, ECST.#OP is true.
In the event of incorrect parameters or stack state, the function will produce the corresponding
runtime error.
9.3.1.3 ECUNMAP
Description:
The ECUNMAP is used for resetting all previous mapping defined by ECIN and ECOUT.
Syntax:
ECUNMAP
Comments:
The function call is legal only when stack is operational, that is, ECST.#OP is true.
9.3.1.4 ECCLRREG
Description
ESC Error Counters Registers Clear. The ECCLRREG function clears the contents of the error
counters registers.
Syntax
void ECCLRREG(index,offset)
Arguments
Return Value
None
Comments
When the Offset value is -1, all error counters in all slaves are cleared. Otherwise, only the
specific register at the specified Offset is cleared.
After executing the ECCLRRG function, we recommend to execute the FCLEAR function
without parameters before running ECGETREG.
Example
Run the following code example in a Program Buffer.
ECCLRREG(0,0x310)
FCLEAR
STOP
You can also enter this code in the SPiiPlus MMI Application Studio Connection Terminal:
ECCLRREG(0,-1).
9.3.1.5 ECGETREG
Description
ESC Error Counters Registers (Beckhoff Memory). The ESCs have numerous error counters
that help you detect and locate errors. The ECGETREG function enables you to view the
contents of these registers.
Syntax
int ECGETREG(index,offset)
Arguments
Return Value
None
Comments
The following table lists supported error counter registers.
Example
Run the following code example in a Program Buffer.
I0=ECGETREG(0,0x310)
STOP
You can also enter this code in the SPiiPlus MMI Application Studio Connection Terminal:
?ECGETREG(0,0x310).
9.3.1.6 ECGETSLAVES
Description
This function is used to retrieve the number of slaves in an EtherCAT network.
Syntax
ECGETSLAVES
Arguments
None
Return Value
Number of EtherCAT slaves in the network.
Comments
If a slave was added or removed, the ECRESCAN command should be used before using
ECGETSLAVES again.
9.3.1.7 ECUNMAPIN
Description
This function is used to reset all previous mapping defined by ECIN to a specfic offset.
Syntax
ECUNMAPIN(ECOffset)
Arguments
ECOffset An integer providing the offset to which a variable was mapped using ECIN.
Return Value
None
Comments
The mapping is allowed only when stack is operational.
Example
Given the previous execution of ECIN(48,I0), ECUNMAPIN(48) will unmap only I0.
9.3.1.8 ECUNMAPOUT
Description
This function is used to reset all previous mapping defined by ECOUT to a specfic offset.
Syntax
ECUNMAPOUT(ECOffset)
Arguments
ECOffset An integer providing the offset to which a variable has been mapped by
ECOUT.
Return Value
None
Example
Assuming previous execution of ECOUT(48,I0) and ECOUT(50,I1), executing
ECUNMAPOUT(48) will unmap only I0.
Note
The #ETHERCAT command can be used to check if a slave has Mailbox
support.
9.3.2.1 COEWRITE
Description:
The COEWRITE function is used to write a value into a given slave.
Syntax:
COEWRITE[/size] (int slave,int Index,int Subindex,real Value)
Arguments:
Comments:
In case of wrong parameters, the corresponding runtime error will be generated. The function
cannot be used in the SPiiPlus MMI Application Studio Communication Terminal. The
function delays the buffer execution on its line until it is successful or fails the whole buffer
with timeout or other error.
9.3.2.2 COEREAD
Description:
The COEREAD function is used to read a value from a given slave.
Syntax:
real COEREAD[/size] (int slave,int Index,int Subindex)
Arguments:
Comments:
The function returns the received value or fails with runtime error.
In case of wrong parameters, the corresponding runtime error will be generated. The function
cannot be used in the SPiiPlus MMI Application Studio Communication Terminal. The
function delays the buffer execution on its line until it is successful or fails the whole buffer
with timeout or other error.
Stores the line number that caused the error in the corresponding element of the PERL
array
Activates the #PROG fault. The default controller response to the fault is to kill all
executed motions.
No error prompt is issued. You must analyze the state of the buffer in order to detect program
errors. For example:
?1 Query the state of buffer 1
Buffer 1: 78 lines, run-time error 3077 in line 37
?PERR(1) The state also can be monitored through variable PERR
3077
11 Application Examples
This chapter contains practical examples for use in SPiiPlus applications.
For further examples, registered users may go to www.AcsMotionControl.com and download
pertinent documents (selected from the Categories dropdown list on the page).
Only the third row is entered to a controller variable and is stored in the flash X_ERROR file.
Details of the calibration routine, which can be implemented using ACSPL+, are not discussed
here.
An application that uses the file may provide an initialization routine like this:
real X_ERR(11) Declare real array X_ERR with 11
members.
AUTOEXEC: ACSPL+ label initializing the routine on
start-up.
WRITE X_ERR Write to and read from the calibration table
READ X_ERR in the flash memory.
CONNECT RPOS(0)0 = APOS(0) - MAP (APOS(0), X_ERR, 10000, 1000)
STOP Finish initialization
The CONNECT function specifies that the reference position be calculated by subtracting the
interpolated error from the desired position so that the actual value will be closer to the desired
value.
And the X_CALIBR file can also contain a table with non-uniform points.
By using this CONNECT, the value added to desired position changes immediately when the
direction of the motion changes. In many cases such jumps in the desired position are harmful.
In this case the third parameter in the DSIGN function (see SPiiPlus Command & Variable
Reference Guide) can be used to gradually implement the backlash compensation. In the
following example the backlash compensation is introduced by small steps, so that the
compensation growth to the entire value by 20 milliseconds:
CONNECT RPOS(0) = APOS(0) + 10*dsign(RVEL(0), 0, 20)
If the 0 axis executes master-slave motion slaved to some physical value like encoder feedback,
the RVEL value contains noise that can cause undesirable switching of the backlash sign. In
this case the second parameter of the DSIGN function can be used to introduce anti-bouncing
effect. In the following example the backlash compensation changes its sign only if RVEL
holds its new sign for more than 10 milliseconds:
CONNECT RPOS(0) = APOS(0) + 10*DSIGN(RVEL(0), 10, 20)
11.6 Joystick
Assume that a joystick that controls the motion of an X,Y table is connected to analog inputs
AIN(0), AIN(1). The velocity of each coordinate must be proportional to the corresponding
analog input. Analog input lower than 20 counts must be ignored to avoid motion due to analog
drift or bias. The X (axis 0) motion is limited in the range from -500 to 100000 counts. The Y
(axis 1) motion is limited in the range from -500 to 500000 counts.
The following program fragment initializes the joystick motion:
real JK
JK = 10 Joystick factor
MASTER MPOS(0) = INTGR(AIN(0), 20, -500, 100000) Define 0 master
MASTER MPOS(1) = INTGR(AIN(1), 20, -500, 500000) Define 1 master
SLAVE(1) Start master-slave motion