Turbo PMAC Training
Turbo PMAC Training
Turbo Clipper
PeWin32Pro2
Turbo PMAC VME UMAC
2
¾ History:
General ‘76-’81
General + Motion Control ‘81-’85
Motion Control Only ‘85 Onward
Motion Control Systems, N.C. ‘95
¾ Yearly Turnover:
Approx. $50 million total
¾ Financing:
Self Financed – Independently Owned
¾ Number of Employees:
Over 200 Worldwide
¾ Facilities:
120,000 sq. ft (approx. 12,000 sq. m.) since ‘99
Excellent Production and R&D Facility
¾ Operation:
ISO-9001-2008 Certified (Dec. ‘06)
Automated Inventory Control (Bar coding)
SMT Assembly Line (Lead-free, RoHS)
Automated Visual and X-Ray Inspection
Automatic In-Circuit Testing
Semi-Automated Functional Testing
Test Results and Date Code Traceability
3
Turbo PMAC Training About Delta Tau
Delta Tau is home of the PMAC
¾ HQ:
Chatsworth, California USA
¾ International Offices:
Switzerland, UK, Korea, Japan, China
¾ Regional Offices:
Multitude of field engineers, distributors
and integrators across the US and the world
Delta Tau Website: www.deltatau.com
Product Information
Distributors and Integrators Contacts
Latest Manuals
Application Notes
White Papers
Software Downloads
Technical Support Contacts
Technical Support Forum
4
Turbo PMAC Training About Delta Tau
Overview of Training Sections
Day 1: Day 3:
PMAC Introduction Machine I/O
PeWin32Pro2 PLC Programs
Manuals and PMAC Variables In-program data gathering
Clocks and Multitasking Final Motion Program and PLC Exercises
DC Brush Motor Setup
Day 4:
DC Brushless Motor Setup
Servo Loop Tuning Advanced: Memory and I/O Map
Advanced: Kinematics
Day 2: Advanced: Position Compare
Servo Loop Algorithm Advanced: Evolution of the Amplifier
Jog Commands Advanced: Commutation
Triggered Jog Moves (Homing)
Day 5:
Coordinate Systems
Quick Data Gathering Advanced: Position Following
Motion Programs Advanced: C.S. Transformation
Linear/Circular Move Modes Advanced: Timebase Control
Rapid, Spline, and PVT Move Modes Advanced: Lookahead
Advanced: Subprograms
Advanced: Compensation Tables
5
Turbo PMAC Training About Delta Tau
Introduction To PMAC
6
PMAC stands for Programmable Multi-Axis Controller
PMAC is one of the world’s most flexible and powerful motion controllers (& PLCs), it is used in a
wide variety of applications ranging from the simplest to those requiring extremely high performance.
Requirements such as accuracy, precision, speed, and power, whether combined or independently.
7
Turbo PMAC Training Introduction To PMAC
Machine Control Solutions
By Form Factor:
ISA/PCI VME
Controllers
Control Systems
Intelligent Amplifiers
Turbo PMAC PCI
Amplifiers
Turbo PMAC VME
Standalone: USB/Ethernet
8
Turbo PMAC Training Introduction To PMAC
UMAC Universal Motion and Automation Controller®
Open Architecture. Modular and Expandable Design
Custom configuration with simplified integration
Controllers Latest R/D development.
Custom accessories
Control Systems
Turbo UMAC - Turbo PMAC2 CPU and all accessories
Intelligent Amplifiers
MACRO UMAC - UMAC MACRO Station
Amplifiers Compact UMAC CPCI - Custom Backplane and Breakout
!Certified!
9
Turbo PMAC Training Introduction To PMAC
Controller/Amplifier Combinations
UL
ved
Appro
Geo Brick Drive
Controllers 240 VAC Single or 3-Phase Operation
4, 6, or 8-axis @ 5A/10A or 8A/16A
Control Systems (Axes 5&6 @ 15A/30A)
Compact & Very Cost Effective !Certified!
10
Turbo PMAC Training Introduction To PMAC
Panel Mount Amplifiers
Controllers
Control Systems
Intelligent Amplifiers Geo PWM Drive Geo MACRO Drive Geo PMAC Drive
Amplifiers
MACRO Control Systems
3U Amplifiers (Rack Mounted)
CNC Systems Analog (+/-10V) OR Direct PWM interface
Software
11
Turbo PMAC Training Introduction To PMAC
MACRO Controllers
Controllers
VME Ultralite
MACRO Amplifiers
12
Turbo PMAC Training Introduction To PMAC
Advantage 900
Controllers Built-in PC Motherboard Pentium
4, 1 to 3 Ghz, 128 / 512M RAM,
USB2 and Ethernet
Control Systems
Intelligent Amplifiers
Amplifiers
MACRO Control Systems
CNC Systems
PMAC NC Pro2 Software
Software
13
Turbo PMAC Training Introduction To PMAC
Development & Interface
Controllers
Control Systems
Intelligent Amplifiers
Amplifiers
MACRO Control Systems PMAC Executive Pro2 PMAC HMI Pro2
CNC Systems
Software
14
Turbo PMAC Training Introduction To PMAC
Application Videos
http://www.deltatau.com/dtmc/index.html
15
Theory Of Operation
16
Turbo PMAC Training
Turbo PMAC Is A Computer
Turbo PMAC handles all of the tasks required for machine control, constantly switching back
and forth between the different tasks thousands of times per second.
¾ Turbo PMAC consists of:
A Digital Signal Processor (Motorola’s DSP56300 family)
Machine interface ICs, ASIC (i.e. Servo, MACRO)
Memory (SRAM & Flash)
Digital electronic circuitry
Power electronic circuitry (i.e. amplifier products)
Feedback:
A quad B, Sinusoidal, Serial,
Resolver, Incremental, Absolute
Command Motor
Communication:
Output: Types:
USB
±10V Brush
Ethernet
PWM Brushless
Serial
PFM Induction
PCI
Sinusoidal Stepper
VME
Fieldbus
Motor/Encoder
PC/HMI
User Interface PMAC Amplifier
Machine
Inputs/Outputs
18
Turbo PMAC Training Theory Of Operation
Feedback:
A quad B, Sinusoidal, Serial,
Resolver, Incremental, Absolute
Command Motor
Communication:
Output: Types:
USB
±10V Brush
Ethernet
PWM Brushless
Serial
PFM Induction
PCI
Sinusoidal Stepper
VME
Fieldbus
Motor/Encoder
PC/HMI
User Interface PMAC Amplifier
Machine
Inputs/Outputs
19
Turbo PMAC Training Theory Of Operation
Feedback:
A quad B, Sinusoidal, Serial,
Resolver, Incremental, Absolute
Communication: Motor
Types:
USB
Brush
Ethernet
Brushless
Serial
Induction
PCI
Stepper
VME
Motor/Encoder
PC/HMI
User Interface
Machine
Inputs/Outputs
20
Turbo PMAC Training Theory Of Operation
Feedback:
A quad B, Sinusoidal, Serial,
Resolver, Incremental, Absolute
Communication: Motor
Types:
USB Intelligent Amplifier: Brush
Ethernet
Geo Brick Drive Brushless
Serial
Geo Brick LV Induction
PCI
Turbo Clipper Drive Stepper
VME
Geo PMAC
Motor/Encoder
PC/HMI
User Interface
21
Turbo PMAC Training Theory Of Operation
Feedback:
A quad B, Sinusoidal, Serial,
Resolver, Incremental, Absolute
Communication: Motor
Types:
USB
Brush
Ethernet
Brushless
Serial
Induction
PCI
Stepper
VME
Motor/Encoder
PC/HMI
User Interface
Machine
Inputs/Outputs
22
Turbo PMAC Training Theory Of Operation
Feedback:
A quad B, Sinusoidal, Serial,
Turbo PMAC Ultralite Resolver, Incremental, Absolute
Or equivalent
Motor/Encoder
PC/HMI
User Interface
Local General Purpose I/Os / Built-in
Machine I/O:
Analog / digital / Fieldbus Advantages:
Distributed Control
Noise immunity
One Ring, Multiple Masters / Stations
Hundreds of motors
Large Machines (~ 4 miles)
Flexible Structures
Machine
Inputs/Outputs
23
Turbo PMAC Training Theory Of Operation
UMAC Training Rack
The UMAC training rack is a mockup of a complete machine setup.
¾ The UMAC training rack consists of:
Turbo PMAC2 CPU
Axis Expansion/Interface Card(s)
Inputs and Outputs I/O Card(s)
Logic And Bus Power Supply
Amplifiers
Motors with encoders
Flag and Limit switches
Power Supply
Axis Interface
Motors
CPU
24
Turbo PMAC Training Theory Of Operation
Encoder Input
Digital Inputs
Digital Outputs
±10V PWM
Amplifier Output
Motor Flags
25
Turbo PMAC Training Theory Of Operation
Getting Started
¾ Logic power requirements
Board level, Turbo Clipper: +5 VDC, ±12 VDC
Brick series, Amplifiers: +24 VDC
UMAC rack: From built-in power supply (110 VAC)
¾ Power Supply
DC output +5V, ±15V ●
¾ CPU
Let’s power up the UMAC training racks Power PWR good ●
and check the status LEDs! Watchdog WD ●
¾ Axis Card
Power PWR good ●
Encoder power ●
26
Turbo PMAC Training Theory Of Operation
Software Interface
27
Turbo PMAC Training
¾ Development Software (PMAC Executive Pro2 Suite for Windows)
Motor setup, PLC/Motion programs, troubleshooting and
diagnostic, online commands:
PeWin32Pro2
Tuning
Plotting
Automatic setup utilities
¾ Communication Library
For custom front-end interface written in high level
Language, .NET, C++, C#, Visual Studio:
PcommServer
28
Turbo PMAC Training Software Interface
Establishing Communication
USB / PCI / ISA Ethernet
Serial (RS232)
29
Turbo PMAC Training Software Interface
One-Time Setup
30
Turbo PMAC Training Software Interface
¾ Terminal Window
Online commands Online commands are sent directly to PMAC. Issuing bad/wrong
commands can lead to dangerous conditions.
Querying and writing to variables Caution
Direct read/write of memory registers
Run Motion Program, Enable, Disable PLC
31
Turbo PMAC Training Software Interface
¾ Watch Window
The watch window reads from and writes to the PMAC constantly.
Continual monitoring of variables Inserting bad/wrong commands or variables can lead to dangerous
Direct read of memory registers Caution
conditions.
32
Turbo PMAC Training Software Interface
¾ Position Window
Motor Position, Velocity, Following Error
Unit Conversion Capability
33
Turbo PMAC Training Software Interface
¾ Motor Status Window ¾ Global Status Window
Monitoring motor status dynamically Monitoring PMAC status dynamically
Troubleshooting exercises Troubleshooting exercises
In position, and status bits Global errors
34
Turbo PMAC Training Software Interface
¾ Editor
Compose/edit Motion and PLC programs Downloading bad/wrong commands or variables can lead to
dangerous conditions.
Download code to PMAC Caution
Debugging
Upload data from PMAC
35
Turbo PMAC Training Software Interface
Manuals and PMAC Variables
Essential Reference Manuals
¾ I-Variables
Initialization and setup variables
Have predefined meanings
¾ P-Variables
General purpose user variables w/ 48-bit floating point format
Global access (regardless of coordinate system)
¾ Q-Variables
General purpose user variables w/ 48-bit floating point format
Specific to a coordinate system
¾ M-Variables
Provide user access to memory and I/O
Users define address, offset, and bit width
1 1 0001
¾ Example:
2 2 0010
4 4 0100
Bit 7 6 5 4 3 2 1 0
5 5 0101
Binary 0 1 0 1 1 1 0 0
6 6 0110
Hexadecimal 5 C 7 7 0111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111
¾ Categories of I-Variables
Access Location 1 2 4 8 16
$8000
$81FF C.S.1
C.S.1
$8200 Q0~Q1023
$83FF C.S.9
C.S.1
$8400 Q0~Q2047
$85FF C.S.5
C.S.5
$8600 Q0~Q1023
$87FF C.S.13
C.S.1
$8800 Q0~Q4095
$89FF C.S.3
C.S.3
$8A00 Q0~Q1023
$8BFF C.S.11
C.S.3
$8C00 Q0~Q2047
$8DFF C.S.7
C.S.7
$8E00 Q0~Q1023
$8FFF C.S.14
C.S.1
$9000 Q0~Q8191
$91FF C.S.2
C.S.2
$9200 Q0~Q1023
$93FF C.S.10
C.S.2
$9400 Q0~Q2047
$95FF C.S.6
C.S.6
$9600 Q0~Q1023
$97FF C.S.15
C.S.2
$9800 Q0~Q4095
$99FF C.S.4
C.S.4
$9A00 Q0~Q1023
$9BFF C.S.12
C.S.4
$9C00 Q0~Q2047
$9DFF C.S.8
C.S.8
$9E00 Q0~Q1023
$9FFF C.S.16
¾ Q0 through Q8191 can all be used in Coordinate System 1 (&1) if there is only one
coordinate system.
¾ If 16 coordinate systems are used, every coordinate system can have Q0 through
Q511 without register conflict.
M9->Y:$10F0,8,8
Prefix
M-Variable
¾ Definition Types
X: 1 to 24 bits fixed-point in X-memory
Y: 1 to 24 bits fixed-point in Y-memory
D: 48 bits fixed-point across both X and Y-memory
L: 48 bits floating-point across both X and Y-memory
DP: 32 bits fixed-point (low 16 bits of X and Y)
F: 32 bits floating-point (low 16 bits of X and Y)
M9->Y:$10F0,8,8,U
Format: U for unsigned and S for signed
Width: Default width is 1
Offset: Starting bit number
Address
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Width 8 bits
Description Address/Definition
¾ In PEWIN32PRO2, “Configure” menu,
“M-Variables”
¾ Programs
Motion Program
One move at a time, all calculations done up to that move
PLC Program
Programmable Logic Controller, continuously being scanned
Priority
High ¾ Single Character I/O
Bringing in or sending out a single character, from or to the host port
¾ Phase cycle
Commutation update for commutated (brushless) motors
¾ Servo cycle
Commanded and actual position difference calculation
Output type conversion for different amplifiers
¾ Background Tasks
Execute Enabled PLCs / PLCCs
Communication response, safety check, housekeeping
Limits, Amplifier faults, and watchdog check
Low
50 Multi-Tasking and Clock Settings
Turbo PMAC Training
Clock Setting
¾Clock source
A crystal vibrating with frequency 117,964.8 kHz in Servo IC
Dividing source frequency with numbers generates other frequencies (clocks)
-I7m00-2
MaxPhase Freq.
Phase Clock Frequency = kHz
(I7m01+1)
Phase Clock Freq.
Servo Clock Frequency = kHz
(I7m02+1)
Servo Clock Freq.
Real Time Interrupt Freq. = kHz
(I8+1)
PLC1
PLC1
PLCC1~31
H.K.
PLCC1~31
H.K.
PLC2 . . .
PLC2
SERVO
. . .PLC2 PLCC1~31
H.K.
PLCC1~31
H.K. PLC3
PLC3. . .
SERVO
PLCC1~31
MOTION H.K.
PLC0,PLCC0
PLCC1~31
PLCC1~31
H.K.
SERVO
R.T.I interrupt
H.K.
Servo interrupt
Phase interrupt
PLC5
PLC4
Multi-Tasking Example
PLCC1~31
H.K.
SERVO
MOTION
Task
R.T.I.
I7m01
I8+1=2
Background
I7m02+1=2
Servo Cycle
Phase Cycle
59 Motor Setup
Turbo PMAC Training
Motor Types
¾ Brush
¾ Brushless (servo)
Rotary/Linear
¾ Induction (Advanced)
60 Motor Setup
Turbo PMAC Training
Dominant Clock Settings
61 Motor Setup
Turbo PMAC Training
DC Brush Motor Setup
Step 1: Motor Activation (Ixx00)
Step 2: Encoder Conversion Table (I8000s). Type Of Encoder Device.
Step 3: Position/Velocity Feedback (Ixx03, Ixx04)
Step 4: Output Mode: DAC (I7mn6)
Step 5: I2T Protection, Maximum Command Output (Ixx57, Ixx59, Ixx69)
Step 6: Flags, Overtravel Limits (Ixx25, Ixx24)
Step 7: DAC Calibration (Ixx29)
Step 8: Open Loop Test (I7mn0)
Step 9: PID/Position Loop Tuning (Ixx30-Ixx39, Ixx68)
Step 10: Homing and Jogging Settings
Step 11: Simple Jog Moves
Steps 1 through 3 (feedback) are the same for the same type of
encoder regardless of the type of the motor.
Note
62 Motor Setup
Turbo PMAC Training
Step 1: Motor Activation (Ixx00)
Note
63 Motor Setup
Turbo PMAC Training
Step 2: Encoder Conversion
Table (I8000s)
64 Motor Setup
Turbo PMAC Training
Encoder Conversion Table
The Encoder Conversion Table (ECT) allows the processing of virtually any kind of feedback
device (raw data). It produces encoder/motor counts used for the servo algorithm, user display
(position window), and for general programming purposes.
65 Motor Setup
Turbo PMAC Training
Encoder Conversion Table
Equivalent Turbo PMAC code to set up the Encoder Conversion Table for Motors 1 and 2
I8000=$78200 ; Encoder Conversion Table Entry 1
I8001=$78208 ; Encoder Conversion Table Entry 2
Turbo PMAC Script
66 Motor Setup
Turbo PMAC Training
Step 3: Position/Velocity Feedback
(Ixx03, Ixx04)
After setting up the ECT, PMAC needs to know where to obtain the ECT results. Set Ixx03
and Ixx04 to the ECT result addresses to close the Position and Velocity Feedback Loops:
Now rotate the unloaded motor shafts by hand. Do you see these motors’ position values
changing in the position window? If so, proceed. If not, double-check wiring and settings up to
this point and then retry.
67 Motor Setup
Turbo PMAC Training
Step 4: Output Mode, DAC (I7mn6)
I7mn6 controls which output formats are used on the command output signal lines for
machine interface channel n of a PMAC2-style Servo IC m.
68 Motor Setup
Turbo PMAC Training
Step 5: I2T Protection
(Ixx57, Ixx58, Ixx69)
¾ Ixx57 sets the magnitude of the maximum continuous current limit for Turbo PMAC’s
integrated current limiting function.
Ixx57 = Int ⎨
( )
⎧ 32768 ⋅ ic ⎫ ic : Continuous
⎬ current rating
⎩ imv ⎭ [amps]
The current value [amps] at which the amplifier produces a 10 V output
¾ Ixx58 sets the maximum integrated current limit for Turbo PMAC’s I2T or |I|T integrated
current limiting function.
Time
(Ixx69) 2 − (Ixx57) 2 permitted at
Ixx58 = 2
⋅ f s ⋅ t p peak current
32768 limit [sec]
Servo Freq. [Hz]
¾ Ixx69 defines the magnitude of the largest output that can be sent from Turbo PMAC’s
PID position/velocity servo loop.
⎧ 32768 ⋅ (i p )⎫
ip : Peak current
Ixx69 = Int ⎨ ⎬
rating [amps]
⎩ imv ⎭
The current value [amps] at which the amplifier produces a 10 V output
69 Motor Setup
Turbo PMAC Training
Need to know amplifier gain (amps/volt), to calculate Max. Amp. Output Current.
Max. DAC output voltage is 10V.
I158=INT((I169*I169 - I157*I157)*2.259*1000*2/(32767*32767))
I258=I158 ; Assumes Motor 2 is the same as Motor 1
70 Motor Setup
Turbo PMAC Training
I = Measured Current
I2
Ixx692
E1 – E2 + E3 ≥ Emax
Emax This triggers I2T fault
Ixx572 Time
Emax is defined by Ixx58
Maximum Time E1 and E3: Integrator Charge-Up
allowed under Max Current
E2 and E4: Integrator Discharge
I2
Saturation I2T Fault
Ixx692
E1
E3
Ixx572 Time
E2
E4
71 Motor Setup
Turbo PMAC Training
Step 6: Overtravel Limits, Flags
(Ixx24, Ixx25)
Binary 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Bit 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
72 Motor Setup
Turbo PMAC Training
// Ixx24 Motor xx Flag Mode Control
I124,2,100=$1 ; Set Motor 1 and 2 flag mode control for PMAC2-Style Servo IC
¾ Ixx24 specifies how the flag information in the registers specified by Ixx25, Ixx42,
and Ixx43 is used.
¾ Ixx25 tells Turbo PMAC which registers to access for its position-capture flags,
and possibly its overtravel limit input flags and amplifier enable/fault flags, for
Motor xx.
Be sure to download all of the previous settings and issue a save and
$$$ command before continuing to the next section of motor setup.
Note
73 Motor Setup
Turbo PMAC Training
Step 7: DAC Calibration (Ixx29)
DAC offset can be compensated for with Ixx29 in units of 16-bit DAC bits. To manually
calibrate the DAC:
1. Issue a #no0 command, for motor n, and then immediately #nk to kill the motor. If the
motor does not move, the offset is fine.
2. If the motor moves in the positive direction, decrease Ixx29 appropriately until #no0
produces no motion
3. If the motor moves in the negative direction, increase Ixx29 appropriately until #no0
produces no motion
74 Motor Setup
Turbo PMAC Training
Step 8: Open Loop Test
The Open Loop Test makes sure that when outputting positive
command, the encoder position count also goes up.
75 Motor Setup
Turbo PMAC Training
¾ Select a beginning open loop magnitude
of 5%, click “Open Loop Test”, and
increment the magnitude up if needed
until satisfactory results are obtained
This test moves the motor noticeably. Make sure all loads are
disconnected from the motor before executing the open loop test!
WARNING
76 Motor Setup
Turbo PMAC Training
Correct Response
Incorrect Responses
77 Motor Setup
Turbo PMAC Training
Open Loop Test Troubleshooting
¾ If the shape of the result does not conform to the shape shown in the picture on
the right in the previous slide, try increasing the output magnitude (do not
exceed 10%) or decrease the output duration
78 Motor Setup
Turbo PMAC Training
Step 9: PID / Position Loop Tuning
¾Auto Tuning
Under PEWIN32PRO2, Tools menu, PMAC Tuning Pro2
Auto-tuning routine provides an easy way to tune and analyze motor-driver systems
¾Interactive Tuning
Detailed discussion in later section
79 Motor Setup
Turbo PMAC Training
PMAC Auto-Tuning: Stage 1
80 Motor Setup
Turbo PMAC Training
PMAC Auto-Tuning: Stage 2
¾ In Stage 1
Conservative Bandwidth, Proportional and
Derivative gain will be selected
Multiply conservative bandwidth by 2 or 3 as
the new bandwidth
¾ Uncheck
Auto Select Bandwidth
¾ Click on
Re-calculate the gains
Followed by Auto Tune to reevaluate the
gains
81 Motor Setup
Turbo PMAC Training
PMAC Auto-Tuning Stage 3
¾ Uncheck
None in Integral Action, and select soft or hard level of integral with sliding bar
¾ Bandwidth
Increase bandwidth until motor buzzes, and then decrease the bandwidth slightly until it just
stops buzzing
82 Motor Setup
Turbo PMAC Training
Servo Loop Tuning
After
Set between 0.707 everything
and 1.000 is set, click
“AutoTune”
Select feed
forward gains
Select integral action level (system-dependent); ½ way up will usually work to start jogging the
UMAC demo motors
83 Motor Setup
Turbo PMAC Training
Servo Loop Tuning
The resulting screen shows the computed gains from auto-tuning.
If satisfied, click
“Implement”
and then “OK”
Note
84 Motor Setup
Turbo PMAC Training
Servo Loop Tuning
Click to select Interactive Tuning, which allows the user to manually tune the motors finely to get
the desired following error tolerance
85 Motor Setup
Turbo PMAC Training
Well-Tuned Step Response Example
Commanded Position
If your response does not look exactly like this, do not fret. You will
learn how to finely tune motors later in the training
Note
86 Motor Setup
Turbo PMAC Training
Well-Tuned Parabolic Move Example
Commanded Velocity
Actual Velocity
Following Error
If your response does not look exactly like this, do not fret. You will
learn how to finely tune motors later in the training
Note
87 Motor Setup
Turbo PMAC Training
Step 10: Homing and Jogging
Settings
88 Motor Setup
Turbo PMAC Training
Step 11: Simple Jog Moves
#1J+
Positive Direction
Jog Move Mode
Motor Number
Addressing Motor
89 Motor Setup
Turbo PMAC Training
Additional Steps
At this point in the motor setup, one should in this order:
1. Connect the load
2. Ensure that the hardware position limit switches are working properly
90 Motor Setup
Turbo PMAC Training
Brushless Motor Setup
Step 1: Activate motor (Ixx00 = 1), enable commutation (Ixx01 = 1).
Step 2: Encoder Conversion Table (I8000s). Type of Encoder Device.
Step 3: Position/Velocity Feedback (Ixx03, Ixx04)
Step 4: PWM Scale Factor and Output Mode (Ixx66, I7mn6)
Step 5: I2T Protection (Ixx57, Ixx58, Ixx69)
Step 6: Configure amplifier faults and position limits (Ixx24, Ixx25).
Step 7: Current Feedback Address, Commutation Position Address (Ixx82, Ixx83)
Step 8: Commutation Cycle Size (Ixx70, Ixx71)
Step 9: Current Mask and ADC Strobe Word (Ixx84, I7m06)
Step 10: Commutation Angle (Ixx72)
Step 11: ADC Settings (Ixx29, Ixx79, I7m06)
Step 12: Current-Loop Tuning (Ixx61, Ixx62, Ixx76)
Step 13: Motor Phasing (Ixx73, Ixx74, Ixx80)
Step 14: Open-Loop Test, Encoder Decode (I7mn0)
Step 15: Servo Loop Tuning (Ixx30…Ixx39)
Step 16: Configure Homing Flag and Speed, then Home Motor (I7mn2, Ixx23)
Step 17: Simple Jog Moves
91
Turbo PMAC Training
Step 1: Motor Activation (Ixx00)
Ixx00: Motor xx Activation Control
=0 deactivated (default except for Motor #1)
=1 activated
Note
92 Motor Setup
Turbo PMAC Training
Step 2: Encoder Conversion
Table (I8000s)
93 Motor Setup
Turbo PMAC Training
Encoder Conversion Table
The Encoder Conversion Table (ECT) allows the processing of virtually any kind of feedback
device (raw data). It produces encoder/motor counts used for the servo algorithm, user display
(position window), and for general programming purposes.
94 Motor Setup
Turbo PMAC Training
Encoder Conversion Table
Equivalent Turbo PMAC code to set up the Encoder Conversion Table for Motors 3 and 4
95 Motor Setup
Turbo PMAC Training
Step 3: Position/Velocity Feedback
(Ixx03, Ixx04)
After setting up the ECT, PMAC needs to know where to obtain the ECT results. Set Ixx03
and Ixx04 to the ECT result addresses to close the Position and Velocity Feedback Loops:
Now rotate the unloaded motor shafts by hand. Do you see these motors’ position values
changing in the position window? If so, proceed. If not, double-check wiring and settings up to
this point and then retry.
96 Motor Setup
Turbo PMAC Training
Step 4a: PWM Scale Factor (Ixx66)
If the drive’s bus voltage > motor rated voltage:
Motor Rated Voltage [Volts]
Ixx66 =
(1.10 )(I7m00)(Vmotor )
Vbus
DC Bus Voltage of Amplifier [Volts]
Since the Shinano Kenshi Brushless DC motors in our demo racks are rated at 24 VDC and the
drive’s bus is wired at 48 VDC, we use this formula today.
Example (use this today for our training boxes):
#define PWM_DCBusInput 48 ; DC Bus Voltage [VDC] for 3U042 –User Input
#define Mtr3Voltage 24 ; Motor 3 Rated Voltage [VDC] -User Input
#define Mtr4Voltage 24 ; Motor 4 Rated Voltage [VDC] -User Input
Example (do not use this today for our training boxes):
I366=1.10*I7200 ; Motor 3 PWM Scale Factor
I466=1.10*I7200 ; Motor 4 PWM Scale Factor
Ixx66 multiplies the output of the digital current loops for Motor x (which are values
between -1.0 and 1.0) before they are written to the PWM output registers. As such, it
determines the maximum value that can be written to the PWM output register.
When using I7m00, make sure m corresponds to the Servo I.C. that is used for this
motor.
98 Motor Setup
Turbo PMAC Training
Step 4b: Output Mode (I7mn6)
I7mn6 controls which output formats are used on the command output signal
lines for machine interface channel n of a PMAC2-style Servo IC m.
One can use I4900 to determine which I.C. chips are present in the system, and I4901 to
determine which kinds of I.C. chips they are. See the Turbo SRM entries for I4900 and
I4901 for more details.
99 Motor Setup
Turbo PMAC Training
Step 5: I2T Protection
(Ixx57, Ixx58, Ixx69)
¾ Ixx57 sets the magnitude of the maximum continuous current limit for Turbo PMAC’s
integrated current limiting function.
Ixx57 = Int ⎨
( )
⎧ 32768 ⋅ (ic ) 2 ⎫
⎬ ⋅ cos 30 ( )
o
ic : Continuous
current rating
⎩ imv ⎭ [amps]
The current value [amps] at which the amplifier produces a 10 V output
¾ Ixx58 sets the maximum integrated current limit for Turbo PMAC’s I2T or |I|T integrated
current limiting function.
Time
(Ixx69) 2 − (Ixx57) 2 permitted at
Ixx58 = 2
⋅ f s ⋅ t p peak current
32768 limit [sec]
Servo Freq. [Hz]
¾ Ixx69 defines the magnitude of the largest output that can be sent from Turbo PMAC’s
PID position/velocity servo loop.
Ixx69 = Int ⎨
( )
⎧⎪ 32768 ⋅ (i p ) 2 ⎫⎪
( )
ip : Peak current
⎬ ⋅ cos 30
o rating [amps]
⎪⎩ imv ⎪⎭
The current value [amps] at which the amplifier produces a 10 V output
Ixx692
E1 – E2 + E3 ≥ Emax
Emax This triggers I2T fault
Ixx572 Time
Emax is defined by Ixx58
Maximum Time E1 and E3: Integrator Charge-Up
allowed under Max Current
E2 and E4: Integrator Discharge
I2
Saturation I2T Fault
Ixx692
E1
E3
Ixx572 Time
E2
E4
¾ Ixx24 specifies how the flag information in the registers specified by Ixx25,
Ixx42, and Ixx43 is used.
¾ Ixx25 tells Turbo PMAC which registers to access for its position-capture
flags, and possibly its overtravel limit input flags and amplifier enable/fault
flags, for Motor xx.
Be sure to download all of the previous settings and issue a save and
$$$ command before continuing to the next section of motor setup.
Note
Ixx82 tells Turbo PMAC which addresses to read to get its current feedback values
for Motor xx if Turbo PMAC is closing the current loop for this motor.
For a motor commutated by Turbo PMAC (Ixx01 = 1 or 3), Ixx83 tells Turbo PMAC
where to read its commutation (phasing) position information for Motor xx every
commutation cycle.
¾ For these motors (from the Shinano Kenshi datasheet for the motors in our demo
racks):
I7206=$3FFFFF ; Servo IC 2 ADC Strobe Word (set to $3FFFFF for Geo drives)
I7106=$3FFFFF ; Servo IC 1 ADC Strobe Word (set to $3FFFFF for Geo drives)
I7006=$3FFFFF ; Servo IC 0 ADC Strobe Word (set to $3FFFFF for Geo drives)
Ixx84 tells Turbo PMAC which bits of the 24-bit current feedback words to use for the
current value in the current loop equations.
I7m06 controls the ADC strobe signal for machine interface channels on Servo IC m.
Look in the manual for your drive to determine the value to which to set this variable.
I300 = 1 I301 = 1
M314 = 0 M302 = 0 M304 = 0 M307 = 0
I372 = 1365
Turbo PMAC Script
¾ Else, if M305 < 0 and M306 > 0, download this in a new Editor window :
I300 = 1 I301 = 1
M314 = 0 M302 = 0 M304 = 0 M307 = 0
I372 = 683
Turbo PMAC Script
¾ If M305 and M306 have the same sign, then choose a larger value for M302 and M304, like
M302=I7200/10, M304=-I7200/10, for example.
I400 = 1 I401 = 1
M414 = 0 M402 = 0 M404 = 0 M407 = 0
I472 = 1365
Turbo PMAC Script
¾ Else, if M405 < 0 and M406 > 0, download this in a new Editor window :
I400 = 1 I401 = 1
M414 = 0 M402 = 0 M404 = 0 M407 = 0
I472 = 683
Turbo PMAC Script
¾ If M405 and M406 have the same sign, then choose a larger value for M402 and M404, like
M402=I7200/10, M404=-I7200/10, for example.
¾ However, they should ultimately be set to minimize measurement offsets from the A
and B-phase current feedback circuits, respectively (read in Suggested M-variables
Mxx05, Mxx06).
¾ One can write a PLC to automatically determine Ixx29 and Ixx79 by sampling their
values over time while commanding zero current to phases A, B, and C. This topic
can be covered by request on the Advanced Training days (Thursday and Friday).
¾ Start tuning the current loop using the tool in PMAC Tuning Pro2 by selecting Current
LoopÆ Auto Tuning:
Automatically
select a safe
Then begin
bandwidth and
current loop
current loop
automatic
gains
tuning by
clicking here
Click here to
start interactive
tuning
After downloading these settings, issue #3$ #4$ to phase motors 3 and 4.
This test moves the motor noticeably. Make sure all loads are
disconnected from the motor before executing the open loop test!
WARNING
Incorrect Response
¾ For the picture on the left in the previous slide, where the commanded positive output
voltage produces a decrease in motor speed, and vice versa, the encoder decode
variable (I7mn0) has not yet been correctly set. Thus:
If I7mn0 = 3, set I7mn0 = 7
¾ Try phasing the motor again if that was not done properly
Select “AUTO”
Select Motor
Number Here
After
everything is
Set between 0.707 set, click
and 1.000 “AutoTune”
Select feed
forward gains
Select integral action level (system-dependent); ½ way up will usually work to start
If satisfied, click
“Implement”
and then “OK”
Note
Commanded Position
If your response does not look exactly like this, do not fret. You will
learn how to finely tune motors later in the training
Note
Commanded Velocity
Actual Velocity
Following Error
If your response does not look exactly like this, do not fret. You will
learn how to finely tune motors later in the training
Note
126 Motor Setup
Turbo PMAC Training
Step 17: Simple Jog Moves
#3J+
Positive Direction
Jog Move Mode
Motor Number
Addressing Motor
2. Ensure that the hardware position limit switches are working properly
Ixx30~Ixx35
Ixx68
Actual Position
Enc
2. Set Ixx34 (Motor xx PID Integration Mode) – can be changed on the fly as needed
=1, position error integration is performed only when Motor xx is not commanding a move
(when desired velocity is zero)
=0, position error integration is performed always
3. Using the Step Response, tune the following parameters in this order:
1.Proportional Gain, Kp (Ixx30)
2.Derivative Gain, Kd (Ixx31)
3.Integral Gain, Ki (Ixx33)
4. Using the Parabolic Move, tune the following parameters, not necessarily in this
order:
¾Velocity Feedforward, Kvff (Ixx32)
¾Acceleration Feedforward, Kaff (Ixx35)
¾Friction Feedforward, Kfff (Ixx68)
132
Turbo PMAC Training
Interactive Tuning
¾ Interactive Tuning can be accessed in PMAC Tuning Pro2
Interactive Tuning
for Position
Move size
PID gains
Move types
Data to plot
Filter
Position
½ to ¼ rev.
Commanded
Profile
Note:
The intent is to operate within the linear range of the system.
This is usually a step size approx. ½ to ¼ revolution
Velocity Acceleration
Commanded Commanded
Profile Profile
Velocity Acceleration
Commanded Commanded
Profile Profile
¾ Launch PMAC Tuning Pro2 from Tool menu. Tune all available PMAC motors
interactively for minimum following error.
¾ Use previous slides as references to change servo tuning I-Variables to obtain better
performance.
Commanded Position
+ +
1− z −1 Kvff Ʃ
Notch filter
+ +
+ 1+ n z + n z
−1 −2
Ʃ Ʃ
Reference
Kp 1 2
Output to DAC
Position 1+ d z + d z
−1 −2
- + - 1 2
IM
Ki Kd
1− z −1
1− z −1
Velocity Loop Feedback
R(z)
−1 KS(k 0 + L + k 3z −3 )
Input ref. h0 + h1(1− z )
1 + 4(L1z −1 + L + L 3 z −3 )
+ + + + +
Ʃ Ʃ TS(t 0 + L + t 4 z −4 ) Ʃ
1
Ʃ
Ixx69 Ʃ
32 ⋅ Ixx08 s0 U(z)
- - 1 + 8(r1z −1 + L + r4 z − 4 ) 1 + d1 z + d 2 z − 2
−1
+ 215
+ +
Output
s1(1− z−1)
Enc. #1
32 ⋅ Ixx08
Feedback #1
+ Enc. #2
+
Ʃ f0 Ʃ GS(g0 + g1 (1 − z −1 )) ¾ Extended Servo
-
-
Algorithm Parameters
f1(1− z−1)
s0 ~ s1 L1 ~ L3
f0 ~ f1 k0 ~ k3
Enc. #1
h0 ~ h1 KS
32 ⋅ Ixx08
Enc. #2 r1 ~ r4 d1 ~ d2
t0 ~ t4 g0 ~ g2
Feedback #2 TS GS
P
=1/ ω0
144 PMAC Servo Control Algorithm
Turbo PMAC Training
Proportional Control
T(t)
Ref. + e(t)
+ 1 Θ(t)
KP KC KA KT
J ∫ ∫
- -
Kd
d 2Θ
T (t ) = K p • K C • K A • KT • e(t ) − K p • K C • K A • KT • Θ(t ) = J • 2
dt
KC: DAC Conversion Gain
K p • K C • K A • KT
KA: Amplifier Gain
KT: Motor Torque Constant ω0 = , ζ =0
J
ζ : Damping Ratio
dΘ d 2Θ K c ω0 : Natural Frequency
T = K •Θ+c• = − J • 2 , ω 0= , ζ= KJ
dt dt J 2 Θ : Angular Displacement
Τ : Input Torque
C: Damping Coefficient
K: Spring Constant
Θ [rad]
J: Moment of Inertia
t: Time
Example Response:
t [sec]
e(t) T(t)
+ + 1 Θ
J ∫∫
KP KC KA KT
- -
d
Kd
dt
dΘ d 2Θ
T (t ) = −K p • KC • K A • KT • Θ(t ) − K p • KC • K A • KT • Kd • =J• 2
dt dt
This is a damped SHO.
K p • K C • K A • KT K K p • K C • K A • KT
ω0 = , ζ = d
J 2 J
KC: DAC Conversion Gain
KA: Amplifier Gain
KT: Motor Torque Constant
T(t)
Lumped
mass
mg
Ref.
Input
e(t) T(t)
+ + 1
J ∫∫
+
KP KC KA KT +
- - m•g•r Θ
d
Kd
KC: DAC Conversion Gain dt
KA: Amplifier Gain
KT: Motor Torque Constant
148 PMAC Servo Control Algorithm
Turbo PMAC Training
Adding the Integral
Ref.
Input e(t) T(t)
+ + 1 Θ
J ∫∫
+
KP KC KA KT
- + +
-
Ki ∫
m•g•r
d
Kd
dt
dΘ(t )
T (t ) = ( K P • K C • K A • K T ) • [ K i ∫ e(t )dt + e(t ) − Θ(t ) − K d ] = m• g •r
dt
Therefore as t → ∞, e(t)→ 0
Vd
ess = KdΘ
Time
150 PMAC Servo Control Algorithm
Turbo PMAC Training
Block Diagram without Kvff
dΘ
ess= Kd
e(t) T(t)
Θd=Vdt
dt
Θ
+ + 1
J ∫∫
KP KAKcKT
- -
d
Kd
dΘ dt
Kd
dt
Position
Vd
ess = 0
Actual
Trajectory
Time
d
Kvff
dt
T(t)
Θd=Vdt ess= 0
Θ
+ + 1
J ∫∫
KP KAKcKT
- -
d
Kd
dt
dΘ
Kd
dt KC: DAC Conversion Gain
KA: Amplifier Gain
KT: Motor Torque Constant
Θ d (t ) = c 0 + c1 • t + c 2 • t 2
¾ Example: Constant Jerk Trajectory
By choosing:
J1
K aff = → e(t ) = 0
K P • K C • K A • KT
J1 d 2Θd J1 • d 2Θ d
T (t ) = ( ) (K P • K C • K A • KT ) =
K P • K C • K A • K T dt 2
dt 2
d 2Θ d d 2Θ
¾ Since
2
= 2 → Θ d = Θ → No Following Error
dt dt
d2
K af f
dt 2
d
K vff
dt
Θd=Vdt T(t) Θ
+ + 1
J ∫∫
KP KAKcKT
- -
d
Kd
dΘ dt
Kd
dt
Deadband
Deadband width set by Ixx65 in units of 1/16 count
Output of
Filter
Proportional Gain Set by
value of Ixx30 n > 0 provides stiffer servo when
near in-position
n = 0 disables any deadband effect
Desired Position n < 0 reduces gain when near in-position
(n=-16 provides true deadband)
n<-16 provides negative gain when near
n= =16
Two stable in-position (This is of no known use)
n
0
positions only n=-16
e(t) [Following Error]
n=
Dead Band Gain Control:
-3
2
⎛ n + 16 ⎞
Deadband Gain = ⎜ ⎟Ixx30 , where n = Ixx64
⎝ 16 ⎠
DEAD BAND
DEAD BAND
Deadband
Gain
NO GAIN DISCONTINUITIES
n=16
n=0 Ixx30
n=-16
e(t) [Following Error]
157 PMAC Servo Control Algorithm
Turbo PMAC Training
Servo Loop Modifier I-Variables (cont.)
Ixx67: Motor xx Position Error Limit [1/16 Count]
Limits error that filter “sees”
"Friction Sin(α)
Phase A Bias
Command Feedforward"
Velocity
1
1-Z-1
-1 Ixx29
Sin(α−β)
Phase B Bias
Position Ixx68
Error Limit
Input
Deadband "Big Step” Output
Ixx79
Compensation Limit Limit DAC Bias
Commanded (Ixx01=1)
Position +
+ + KP
+
- + - +
Ixx02
Ixx64,65 Ixx67 Ixx69 Bit 16 Ixx29
Actual Integration =1
Position Mode
KD
Integration
Cmd Vel = 0? Ixx79
Limit
Ixx34
Ixx29
Ki
Motor Position
Ixx63
Load Position
Force Loop
Output Command
(to open register) Motor 2 (Position Loop)
Commanded (this is usually a
Force + velocity command)
Trajectory
PID Σdt
- Master Position Loop
Position Output Command
Actual Signal (to open register)
Force Commanded +
Signal Position +
Motor 1 (Force Loop) PID DAC AMP
Trajectory
- M Motor
Actual
Position
Signal ENC1
E Encoder
SG Strain Gage
ADC1
See the “Cascading Servo Loops” section of the Turbo PMAC User
Manual for detailed information on how to configure this type of
hybrid control.
Note
¾ Jog commands are not associated with any particular coordinate system
¾ Jog commands are associated with the currently addressed motor, which can be
changed by using #{motor number}; e.g., #1 selects motor 1
Can also use the Address#P command, where P is a P-Variable containing the number
of the motor you want to address, to select the motor within a PLC or motion program (see
Turbo SRM for more details)
Command Description
J=* Jog to position (in counts) specified in the variable jog register
Jog the incremental distance specified in the variable jog register
J^+ relative to present actual position
Jog the incremental distance specified in the variable jog register
J:* relative to present commanded position
¾ Mxx72 is the suggested M-Variable for the variable jog register. Write to it
before using variable jog commands.
Example:
P1 = 2000
M172 = P1+500 ; Put move location into variable jog register
#1J=* ; Motor 1 jogs to 2500 counts
Turbo PMAC Script
Time
Ixx21 Ixx21 Ixx21 Ixx21
Ixx20 Ixx20
Ixx92 Ixx92
¾ Try all of the jog commands covered in this section on your demo box in the Terminal
Window of PeWin32Pro2
¾ Try changing Ixx19, Ixx20, Ixx21 and Ixx22 settings and observe how each of them
affects the jog
Remember that if you change any jog parameters, you must issue a
new jog command before the change takes effect.
Note
166 Jog Commands
Turbo PMAC Training
Triggered Jog Moves (Homing)
Triggered Jog Moves
¾ Moves that occur after a preconfigured trigger signal and move relative to
trigger-captured position
¾ Hardware Capture
Setting bit 0 of Ixx97 to 0 (default) selects hardware capture
Requires input trigger, not error trigger
Requires position feedback through encoder counter
Requires position and flags from same hardware channel
Captures exact count at any speed in hardware as soon as triggered
¾ Software Capture
Setting bit 0 of Ixx97 to 1 selects software capture
Permits input trigger or error trigger
Any type of position feedback
Potential capture error proportional to speed
Captures position after PMAC background tasks notice the trigger
¾ {jog command}^{constant}
Will jog using the jog command in {jog command} as normal and will complete as
normal unless PMAC encounters the trigger
If PMAC encounters the trigger, the motor will move to the position equal to the captured
position in counts plus the number of counts in {constant}
¾ {axis}{data}^{data}
Will move using the move command in {axis}{data} and will complete as normal
unless PMAC encounters the trigger
If PMAC encounters the trigger, the motor will move to the position equal to the captured
position in user units plus the number of user units in {data}
Must be in Rapid mode for this to work
Time
Ixx21 Ixx21
Ixx21
Ixx20 Ixx22 Desired Velocity Zero = 1
Ixx23 In Position = 1
Trigger Occurs
Ixx16 (when FE in range)
Hardware-Based Position Capture Occurs
Ixx16: Motor xx Maximum Program Velocity Ixx23: Motor xx Home Speed and Direction
Ixx19: Motor xx Maximum Jog/Home Acceleration Ixx26: Motor xx Home Offset
Ixx20: Motor xx Jog/Home Acceleration Time Ixx92: Motor xx Jog Move Calculation Time
Ixx21: Motor xx Jog/Home S-Curve Time Ixx97: Motor xx Position Capture & Trigger Mode
Ixx22: Motor xx Jog Speed
Disable position limits (Ixx24 = $20001 for our demo racks) while
homing to –Lim and Index, then Home, then reenable the limits
(Ixx24 = $1 for our demo racks) to prevent the motor from stopping
prematurely. See the PLC training for an exercise on this.
Note
Setting these up will require using the Turbo SRM extensively. Try
looking at Ixx97, Ixx25, I7mn2, I7mn3, and Ixx12 to set up the trigger
settings.
Note
¾ Motors
Turbo PMAC can control up to 32 motors at the same time
Attributes are specified in terms of raw counts and milliseconds
¾ Axes
Motion is commanded through the use of axes
Each axis can have up to 8 motors assigned to it
Axes can only be specified by letters [X,Y,Z], [U,V,W], and [A,B,C]
Attributes are in terms of user-specified units
176
Turbo PMAC Training
Axis Types
¾ Axis Types
Cartesian Axes
[X,Y,Z] as first set and [U,V,W] as secondary set of linear axes
Only [X,Y,Z] can support cutter radius compensation, circular interpolation, and
matrix axis transformation
Feedrate Axes
By default, [X,Y,Z] are the feedrate axes
Use command “FRAX” to define other feedrate axes
Rotary Axes
Only for [A,B,C] axes
Permits Rollover defined by Ixx27
Motor 1 Motor 2 Motor 3 Motor 4 Motor 5 Motor 6 Motor 7 Motor 8 Motor 9 Motor 10
X Y Z X Y Z X Y Z
Motion Motion
Program 1 Program 2
~~~~~ ~~~~~
One C.S. Two C.S.s’
~~~~~ ~~~~~ running
running
one program the same program
#1->10000X+5000
Address motor 1
Assign to
Axis X with 10000 scale factor
and Offset 5000 counts
4” 2” ¾ Translation Example
O” X (inch) // Translation Axis Definition
Motor #1 #1->10000X+40000
O’ #2->10000Y+20000
// 10000*sin(45)=7071.07
ch
)
#1->7071.07X-7071.07Y
#2->7071.07X+7071.07Y
45º Turbo PMAC Script
Motor #1
O’=O”
182 Coordinate System
Turbo PMAC Training
Quick Data Gathering
Please follow the instructor as he or she leads you through the
basics of gathering and plotting a jog move
Motion Programs
Outline
¾ Purpose of Motion Programs
¾ Can perform mathematical, logical, and I/O related operations like PLCs
Step 1: Define coordinate system with axis definitions (see PMAC Coordinate Systems
section of the training to learn how to do this)
Step 2: Create opening and closing brackets of the program
Step 3: Select the move mode (Linear, Circle1, Circle2, Spline1, Spline2, Rapid,
or PVT)
Step 4: Select absolute (Abs) or incremental (Inc) position programming modes
Step 5: Configure appropriate speed, acceleration, and time settings
Step 6: Program the moves
Step 7: Download the motion program
Step 8: Execute the program with &n Bm R, where n is the coordinate system number
you defined in step 1, and m is the motion program number you defined in step
2. Make sure the motors in that C.S. are in closed-loop mode first.
All that remains are steps 7 and 8, which are just to download the program and then type
#1J/#2J/ &1 B1 R in the Terminal Window
¾ Abs
Use absolute positioning, i.e., relative to origin of coordinate system
¾ Inc
Use incremental positioning, i.e., relative to previous axis position
TS: Specifies the time, at both the beginning and end of the total acceleration time, in
Linear and Circle1/Circle2 mode blended moves that is spent in S-
curve acceleration.
Velocity Velocity
TM
Time Time
TS TS
TA TA
TA
Area is move distance
The effect of each of these commands on each Move Mode will be described
more in detail in each subsequent Move Mode section of the training.
Note
193 Motion Programs
Turbo PMAC Training
Feedrate Command
¾ Commands
F {velocity} ; Feedrate (velocity) defintion
Frax(Axes) ; Vector feedrate axes definition
Example:
If user distance unit is in inches, and Isx90=1000, then
F 5 means setting tool tip move velocity as 5 inches/sec
Distance
F=
TM
Move time of a move statement can be defined by F or TM. Either one will
reset previous move time definition.
Note
Distance = X 2 + Y 2 + Z 2
¾ To command an axis to move, just write the axis letter and then either a numeric literal
immediately thereafter or a parentheses with a numerical statement therein; e.g.:
X 10 ; Move the X-axis 10 user units
Y(Sin(P1)) ; Move the Y-axis Sin(P1) user units
Turbo PMAC Script
¾ Can command several moves simultaneously by writing them on the same line; e.g.:
¾ Finally, type &n Bm R in the terminal window to start the program. Note that all
motors in the coordinate system must be in closed-loop mode before running the
program
One can easily put a motor into closed loop mode with #nJ/, where n is the motor number
¾ Example:
Delay 1000 ; Delay 1000 msec before continuing motion program
P1000=35
Delay(P1000+45) ; Delay 80 msec before continuing
Turboprogram
PMAC Script
The Delay command will not cause loss of synchronicity with the
master signal when using external time base.
Note
¾ Example:
Dwell 1000 ; Dwell 1000 msec before continuing motion program
P1000=10
Dwell(P1000*5) ; Dwell 50 msec before continuing program
¾ Example:
The Wait command will not cause loss of synchronicity with the
master signal when using external time base.
Note
Blending stops each time inner loop is Putting a move between the two
exited: two EndWhile encountered EndWhile commands makes blending
before next move. continuous throughout entire example.
2 3 4
1
Execute "R"
"S"
"R"
Execute
time
I11 I11 DWELL I11
time
Calculate
¾ To force M-Variable statements to occur at the beginning of the next move, use a
synchronous M-Variable
¾ Just like a normal M-Variable statement but with == rather than = in the assignment
expression
¾ Example:
Open Prog 3 Clear
Linear Abs TA 300 TM 1500 TS 150 ; Define motion parameters
M1==1 ; Machine output 1 will go high just as the X 30 move starts
X 30 ; Move X-axis to 30 user units
M1==0 ; Machine output 1 will go low just as the Y 40 move starts
M2==1 ; Machine output 2 will go high just as the Y 40 move starts
Y 40
M2==0 ; Machine output 2 will go low as the program finishes
Dwell 0 ; This dwell 0 is necessary to force M2==0 to occur
; (dwell 0 acts like a sequenced move here, forcing M2==0 to occur)
Close
Turbo PMAC Script
6000 12000
4000 10000
Motor 1 Speed [cts/sec]
0 6000
0 1 2 3 4 5
-2000 4000
Time [sec]
Position
10000 10000
Motor 2 Speed [cts/sec]
0 6000
0 2 4 6 8 10 12 14
-5000 4000
-10000 2000
-15000 0
Time [sec]
¾ Commands:
Linear ; Linear Move Mode
TM {constant} ; Move Time (msec); Distance = Velocity * TM
TA {constant} ; Acceleration Time (msec); Default value = Isx87
TS {constant} ; S-Curve Time (msec); Default value = Isx88
F {constant} ; Feedrate (user unit/user time); Tool tip velocity
; Move Time = Distance / F
Abs / Inc ; Absolute / Incremental endpoint specification
Example:
Linear ; Linear move mode
TM 1000 TA 500 TS 0 ; Move time 1000 msec, Acc. Time 500 msec, No S-Curve Time
Abs ; Absolute endpoint mode
X 20 Y 10 ; Go to X=20, Y=10
Velocity Velocity
TM
Time Time
TA TA TS TS
TM TM TM
TA TA TA
TM > TA TM = TA TM < TA
Total Time = TM + TA Total Time = TM + TA = 2 * TA Total Time = 2 * TA
TA and TS
TS TS TS TS TA
TA TA TS TS
TA > 2*TS TA = 2 * TS TA < 2 * TS
Total Acc. Time = TA Total Acc. Time = TA = 2 * TS Total Acc. Time = 2 * TS
X X
Velocity
Blending OFF
Time
½TA TM1 TA TM2 ½TA
Velocity Blending ON
Time
½TA TM1 + TM2 ½TA
Circle direction
Circle 1 / Circle 2 ; Clockwise / Counter-clockwise
Circle Commands
X{X Pos.} Y{Y Pos.} Z{Z Pos.} I{data} J{data} K{data}
X{X Pos.} Y{Y Pos.} Z{Z Pos.} R{Radius}
Z Z Z
X Y X Y X Y
X Y X Y
X Y
Y Y
Normal K-1 Circle2
Abs(X,Y) TM 2000
Inc(R) R<0 X 0 Y 10 R 10
Center Circle1 End
(20,20) F 25 (0,10)
X 30 Y 10 I -10 J 10
Circle2
J If Start and End points are TM 2000
I the same, the command R>0 X 0 Y 10 R -10
Start, End can also be just :
(30,10) Start
(10,0)
X I -10 J 10 X
R>0 , path is less than 180°
R<0 , path is greater than 180°
NOT be used for full circle
Starting point is specified from previous move. After Circle1 or
Circle2 command, only End point, Center/Radius are needed
Note
218 Move Modes
Turbo PMAC Training
Rapid Move Mode
Rapid Move Mode provides a point-to-point (jog), PMAC-sequenced move
¾ Commands
Rapid ; Rapid Move Mode, minimum time P2P
Abs / Inc ; Endpoint / Distance specification
Ixx16 / Ixx22 ; Maximum Speed specification
Ixx19 / Ixx20,Ixx21 ; Rate / Acceleration Time
X{data}^{data} ; Move until trigger (Triggered Move)
!X{data}Y{data} ; Altered destination, Abs mode
¾ Trajectory
NO BLENDING with other moves
If acceleration time are matched, it’s a straight line
If Isx79=0, all motors are slowed down to match longest move time
If Isx79=1, each motor goes with it’s own max. speed
2
A
C Rapid
INC
X 20 Y 10
1
X
¾ Commands
I42 = 0 / 1 ; Move time specified by TM / TA
TM / TA ; Segment move time
Spline1 / Spline2 ; Uniform / Non-uniform move time
Abs / Inc ; Absolute / Incremental endpoint
¾ Trajectory
At the beginning and end of a series of spline moves, a zero-distance with TM/TA time
period is added (see Figs.)
Spline between segments is performed
TA TA TA TA TA TA Time
(added) (added)
All segments are the same duration (TA) for Spline1 mode (shown
in this example). In examples above, I42 = 1, and TA time is used.
Note
223 Move Modes
Turbo PMAC Training
Simple Spline Mode Example
Undefine All
End Gat
Del Gat
Close
&1
#1->1000X ; 1000 counts is 1 user unit for X axis
#2->1000Y ; 1000 counts is 1 user unit for Y axis
I42 = 0 ; Use TM to adjust Spline move time
Close
Turbo PMAC Script
0
0 1 2 3 4 5 6
-1
-2 X Axis
Y Axis
-3
-4
Time [seconds]
Using Spline2 to decelerate permits more control over the deceleration profile, allowing the
user to adjust TM on the fly while still maintaining a smooth, continuous motion.
¾ Commands
I42 = 0 or 1 ; Move time specified by TM / TA
PVT {Time} ; PVT move with Move Time
; If no Time specified, uses TM / TA
TM / TA ; Segment move time if no PVT time specified
; Not used if PVT{Time} is specified
Abs / Inc ; Absolute / Incremental endpoint
{Axis}{Position}:{Velocity}
; Move statement, endpoint position and
; velocity specified
¾ Trajectory
Useful for creating arbitrary profiles
Generate Hermite-Spline path
P: Cubic Position
V: Parabolic Velocity
A: Linear Acceleration
T: Move Time
T
Time
Common
Time Time Time
Segment T T T
Velocity Velocity Velocity
Shapes ΔP1=1/6VT
ΔP=VT ΔP=(1/2)(V1+V2)T ΔP2=(5/6)VT
V V2 V
V1
1/2V
1000
900
500
1 2 3 4 5
Time
(msec)
200 300 400 600 1100
Undefine All
End Gat
Del Gat
Close
&1 ; Address C.S. 1
#1->100X ; 100 counts is 1 user unit for X axis
Open Prog 4 Clear ; Open Program 4 buffer and clear
Inc ; Incremental endpoint definition
PVT 200 ; PVT mode with move time T=200 msec
X 133.333:1000 ; Move 1: ΔP=133.333, V=1000
PVT 100 ; Change PVT move time to T=100 msec
X 100:1000 ; Move 2: ΔP=100, V=1000
X 96.667:900 ; Move 3: ΔP=96.667, V=900
PVT 200 ; Change PVT move time to T=200 msec
X 140:500 ; Move 4: ΔP=140, V=500
PVT 500 ; Change PVT move time to T=500 msec
X 83.333:0 ; Move 5: ΔP=83.333, V=0
Close ; Close program buffer
Turbo PMAC Script
228 Move Modes
Turbo PMAC Training
Machine I/O
¾ I/O is processed through specific I/O base addresses in PMAC
Amplifier
Power Block
Machine IO
Connection with
Machine I/O
Analog / Digital
Motor
Feedback Data
M19->Y:$078C07,0,8
Open PLC 10 Clear
M19=$7
Disable PLC 10
Close
Turbo PMAC Script
Register I/O bits 24-31 set to I/O bits 0-7 set to read only
Select read/write I/O bits 8-15 set to read only
Bits I/O bits 32-39 set to I/O bits 16-23 set to read
read/write only
I/O bits 40-47 set to
Different I/O cards will require their Control
read/write
Words to be set specifically based on the card’s
Note specific I/O configuration.
//Outputs:
M33->Y:$078802,0,1 ; Brick Series Output 1
M34->Y:$078802,1,1 ; Brick Series Output 2
M35->Y:$078802,2,1 ; Brick Series Output 3
M36->Y:$078802,3,1 ; Brick Series Output 4
M37->Y:$078802,4,1 ; Brick Series Output 5
M38->Y:$078802,5,1 ; Brick Series Output 6
M39->Y:$078802,6,1 ; Brick Series Output 7
M40->Y:$078802,7,1 ; Brick Series Output 8
Turbo PMAC Script
//Outputs:
M41->Y:$078805,0,1 ; Brick Series Output 09
M42->Y:$078805,1,1 ; Brick Series Output 10
M43->Y:$078805,2,1 ; Brick Series Output 11
M44->Y:$078805,3,1 ; Brick Series Output 12
M45->Y:$078805,4,1 ; Brick Series Output 13
M46->Y:$078805,5,1 ; Brick Series Output 14
M47->Y:$078805,6,1 ; Brick Series Output 15
M48->Y:$078805,7,1 ; Brick Series Output 16
Turbo PMAC Script
237
Turbo PMAC Training
What is a PLC?
¾ PLC normally stands for “Programmable Logic Controller”
¾ A PMAC PLC program is a general-purpose program that runs in PMAC that can run
either in background time (for PLC and PLCC) or foreground time (PLC0 and PLCC0)
¾ Scans through as fast as processor speed allows before the next servo interrupt
¾ Ideal for any task that is asynchronous to motion program sequences and for jogging
and homing routines
Foreground PLCs:
¾ PLC0 and PLCC0
Special priority PLCs – will execute top to bottom at the end of every Real Time Interrupt (RTI)
Execute every real-time interrupt as long as the tasks from the previous RTI have been completed
Keep these short to prevent starving background of time or tripping Watchdog timer
¾ Floating-point operations in compiled PLC programs run two to three times faster
than in interpreted PLC programs; integer (including Boolean) operations run 20 to
30 times faster in compiled form
¾ Can use L-Variables for fast integer arithmetic – just replace your M-Variable
definitions using L-Variables
¾ L- and F-Variables are pointers linked at compile time, rather than at runtime like M-
Variables are
PLC1
PLCC1, 2, 3, 4..
PLC2
PLCC1, 2, 3, 4..
PLC3
PLCC1, 2, 3, 4..
PLC0 and PLCC0 are at a higher priority level and can interrupt any of the
background PLC's
Every PLCC scans through between each PLC scan
Uncompiled: PLC1, 2, 3…31
Compiled: PLCC1, 2, 3, 4…31
¾ Once written in the Editor window (from PeWin32Pro2 click FileÆNew File), click the
“Download” button to download to PMAC
¾Enable PLC n
Enables PLC number n
¾Enable PLCC n Global commands: can be used in
Enables PLCC number n terminal window, within a PLC/PLCC,
or within a motion program
¾Disable PLC n
Disables PLC number n
¾Disable PLCC n
Disables PLCC number n
¾ Example:
If (P134 > 0)
// Tasks
Else
// Other Tasks
EndIf
Turbo PMAC Script
¾ Example:
While(M135 != M189)
// Tasks
EndWhile
Turbo PMAC Script
¾ Example:
#define Loop_Counter P133 ; Names P133 as “Loop_Counter” for this file
Open PLC 1 Clear
Loop_Counter = 1000
While(Loop_Counter > 0)
Loop_Counter = Loop_Counter – 1
EndWhile
Disable PLC 1
Close
Turbo PMAC Script
¾ Just write a value in servo cycles to these variables and use a while loop to wait until
the variable becomes 0
¾ One can multiply the desired wait duration in ms by 8388608/I10 to get the wait
duration in servo cycles to write to the timer variable
¾ Example:
I5111=1000*8388608/I10 While(I5111>0) EndW ; Delay 1000 ms
I5112=500*8388608/I10 While(I5112>0) EndW ; Delay 500 ms
Turbo PMAC Script
¾ Watch your Output LEDs on your Demo Rack as the outputs enable/disable
¾ Need to have one iteration of a WHILE loop occur in order to force PMAC into
housekeeping so that the CMD will execute. This is critical if one uses a sequence of
CMD commands whose execution order matters.
¾ Example: Starting to Gather and then Calling a Motion Program Using a PLC
One can just run this PLC whenever desired in order to start gathering, run motion
program 1 in C.S. 1, and then stop gathering.
One should always use Edge Triggered logic when sending online commands for
jogging, homing or anything that causes motion using the CMD command. This
prevents the command from being dangerously sent repeatedly.
WARNING
254 PLC Programs
Turbo PMAC Training
Arrays
¾ Can index arrays by using the variable notation P(), M(), Q(), L(), and F()
¾ Within the parentheses, put a numeric literal or an expression that will evaluate to the
desired array index
¾ Examples:
P1 = 15 ; P1 is the array index variable in this case
Q1 = 30
P(P1) = 5 ; Same as P15 = 5
M(P1) = 5 ; Same as M15 = 5
P(Q1) = 2 ; Same as P30 = 2
Turbo PMAC Script
¾ Example:
M0->L:$6000 ; Point M0 to address of P0
M1->Y:$4000,0,16 ; Point M1 to the definition word of M0;
; i.e., the part of M0’s word that tells M0 where to point
M0 = 5 ; Same as P0 = 5
M1 = M1 + 1 ; Increments index by 1; now M0 points to P1
M0 = 6 ; Same as P1 = 6
M1 = M1 + 1 ; Increments index by 1; now M0 points to P2
M0 = 8 ; Same as P2 = 8
¾ One must use this technique if he or she desires to manually read the gather buffer
from within PMAC
¾ When using a PLC to jog a motor, one can wait for the jog to finish before advancing
in the PLC by polling these two bits until they both become 1:
Mxx33: Motor xx Desired-velocity-zero bit
Mxx40: Motor xx Background in-position bit
¾ When using a PLC to home a motor, one should poll these three bits until they all
become 1 before advancing:
Mxx33: Motor xx Desired-velocity-zero bit
Mxx40: Motor xx Background in-position bit
Mxx45: Motor xx Home-complete bit (use for homing only)
End Gat
Del Gat
Close
Open PLC 4 Clear
CMD"#1HM" ; Home the motor
I5111=1*8388608/I10 While(I5111>0) EndW ; Force CMD execution before continuing
While(M133 = 0 or M140 = 0 or M145 = 0)EndWhile ; Poll status bits
CMD"#1J=2000" ; Jog to 2000 cts absolute
I5111=1*8388608/I10 While(I5111>0) EndW ; Force CMD execution before continuing
While(M133 = 0 or M140 = 0)EndWhile ; Poll status bits
// Put subsequent code here
// that will execute only after the J=2000 move has completed
Disable PLC 4
Close
Turbo PMAC Script
One should always use edge-triggered logic for jogging and homing in
PLCs, which is what this PLC example uses.
Note
¾ Write a PLC to jog motor 1 forward (J+) while one of the tactile switches is held,
backward (J-) while another is held, to closed-loop stop when released (J/), and to
home (HM) when another is pressed, using CMD commands and delays to force the CMD
execution.
¾ Write a PLC to home the motor based on –Lim and Index (Channel C) flags. In the
PLC, disable the position limits (Ixx24 = $20001 for our demo racks), home the motor,
wait for the home to finish, then reenable the limits (Ixx24 = $1 for our demo racks).
Test it using the –Lim flag on your rack’s input panel. Refer to the Turbo SRM entries
for Ixx97, Ixx25, I7mn2, I7mn3, and Ixx12 for more information on homing settings.
¾ Write a PLC that will turn on various lights based upon the pressing of a switch. Use
a latch (edge triggered) to turn on a light based upon the pressing of a momentary
switch. Keep the light on until the switch is pressed again. The next time the switch
is pressed the light should go off.
¾ PMAC can upload gathered data to the host software to generate plots and
tables to be used for analysis
¾ Useful for:
System Identification
Servo Loop Tuning
Program Debugging
Machine Debugging
Maintenance
Designing Filters
Uploads gathered
data to host
Plots selected data
Motor Number
Calculated Commanded Data
Measured Data Sets gather period
Output Commands (I5049, in units of
servo cycles)
¾ Click “Motors to Gather…” and then select “Commanded” data from Motor 1, and a
gather period of 1, then click “OK”
¾ Then, minimize the window, open a new Editor window, and download the code on the
next slide to PMAC.
¾ Bring the PMAC Plot Pro2 back up and click “Upload Data”
¾ Then, click “Plot Data”, and the following plot should load:
¾ Back on the “Address to Gather” screen, which should now look like the screen on
the previous slide, click “OK”
¾ Then, click “OK” on this screen as well as on the “Scaling and Processing” screen
¾ Then, return to the Detail Plot tab and click “Upload Data”
¾ Select the “Motor 1 Cmd Pos vs. Time” plot under the “Selected Plot” list, and then
click “Plot Data” to get the following plot:
Click here to
hide/show legend
285
Turbo PMAC Training
The following exercises provide suggested program flow charts. Each step is numbered, and
these numbers are repeated in the comments of corresponding example code which is in the
appendix of this document. The idea is to do by yourself what comes easy enough, and refer to
the examples for help as needed or desired thereby individualizing the level of difficulty.
Hardware:
2000 counts per revolution encoder
5:1 gear reduction
1 cm/rev pitch leadscrew
Set Isx92=0 to enable blending
This machine will be sold to a European company which will write some new programs
for it. They only want to program in centimeters so your programs must also use
centimeters.
A feedrate override switch has also been added to the system. Your programmed pauses
must now change as the feedrate override changes. This means that a 1.5 second pause
will last 3 seconds at 50% feedrate override. Use CMD"%50" in a PLC which checks
machine input 1 for feedrate override.
Problem:
The European Company is having a lot of success with your machine and your boss now
has some extra R&D money. He wants you to write another application based on the
same platform. 2 input switches have been connected to PMAC’s machine inputs 1 and
2. He wants these switches to control the motion of the stages as follows:
If machine input 1 is on, the stages should move from 0 cm to 10 cm at a speed
of 1 cm/sec, pause for 1 second then return to 0 cm at the same speed and pause
for 100 milliseconds until looking for the next input.
If machine input 2 is on, the stages should move from 0 cm to -10 cm at a speed
of 2 cm/sec, pause for 1 second, and then return to 0 cm at the same speed and
pause for 100 milliseconds until looking for the next input.
If both machine inputs 1 and 2 are on, or if neither are on, the stages should not
move from 0 cm and should pause for 100 milliseconds until looking for the next
input.
10 inches
10 inches
He wants the shape to be drawn whenever he pushes a button on his desk. Furthermore, he
wants a light to be on while the shape is being drawn and wants the light to be otherwise off.
5000
4000
3000
2000
1000
0
-0.5 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5
Time [sec]
$000000
Internal DSP
Memory
$001FFF
$002000
Fixed-Use Calculation Registers
$003FFF
$004000
M-Variable Registers
$005FFF
$006000 External Static
Standard P-Variable Registers Memory
$007FFF (Flash-Backed)
$008000
$009FFF
Standard Q-Variable Registers
$00A000
$03FFFF
User Program and Buffer Storage
$050000
Optional Battery-Backed RAM Registers Optional
$060000 Memory
$063FFF
DPRAM DPRAM
$070000
$0701FF
Bus Interface ICs
$078000
$07B31F
Servo, MACRO, I/O ICs
¾ Data access
Frequently used data are usually accessed by suggested M-variables
If the data in need is not accessible by a suggested M-Variable, the user needs to define an
M-Variable pointing to the data register in order to access the data
305 Kinematics
Turbo PMAC Training
Kinematics Setup
There are two ways to set up axis definitions:
Need Kinematic Subroutines to specify the nonlinear relationship between motors and axes
Before the execution of a motion program, forward kinematics executes only once to make sure
where the axis starting point is. Can force execution of forward kinematics with the PMATCH
command
Once the axis starting point is established, PMAC uses inverse kinematics to compute
commanded the motor positions
306 Kinematics
Turbo PMAC Training
Reserved Variables for Position
Calculations
¾ If Kinematic Subroutines are used, the following P-Variables and Q-Variables are
reserved for position calculations in Kinematic Subroutines:
P1 through P32 are reserved for positions of motor 1 through 32
Q1 through Q9 are reserved for axis positions in each coordinate system as follows:
Forward
Kinematic
Subroutines
Motor Position Axis Position Motion Program
Commanded
P1 to P32 Q1 to Q9 Axis Position
Inverse
Kinematic
Subroutines
307 Kinematics
Turbo PMAC Training
Kinematics Subroutines
Setup Example:
// Coordinate system 1, Forward and Inverse kinematics setup sample
&1 ; Addressing Coordinate System 1
Open Forward Clear ; Open & clear forward kinematic buffer
;Q1=f1(P1,P2) ; Axis A position in terms of motor 1&2 positions
;Q2=f2(P1,P2) ; Axis B position in terms of motor 1&2 positions
Close ; Close forward kinematic buffer
Open Inverse Clear ; Open & clear inverse kinematic buffer
;P1=g1(Q1,Q2) ; Motor 1 position in terms of Axis A&B positions
;P2=g2(Q1,Q2) ; Motor 2 position in terms of Axis A&B positions
Close ; Close inverse kinematic buffer
Forward Kinematics:
Express [X,Y] in terms of [A,B]
Y
[X,Y] X = L1cos(A) + L 2cos(A + B)
Y = L1sin(A) + L 2sin(A + B)
B
L2 Inverse Kinematics:
Express [A,B] in terms of [X,Y]
L1 A ⎛ X 2 + Y 2 − L21 − L22 ⎞
B = +cos ⎜⎜−1
⎟⎟
X ⎝ 2L L
1 2 ⎠
⎛ X 2 + Y 2 + L2 − L2 ⎞
A = atan2(Y, X) − cos ⎜ −1 1 2 ⎟
⎜ 2L X + Y ⎟2 2
⎝ 1 ⎠
309 Kinematics
Turbo PMAC Training
Forward/Inverse Kinematics
End Gat
Del Gat
Close
// Kinematics Assignments
#define KinPosX Q7 ; X-axis pos in mm for kinematics
#define KinPosY Q8 ; Y-axis pos in mm for kinematics
#define Mtr1Pos P1 ; Motor #1 pos. in cts for kinematics
#define Mtr2Pos P2 ; Motor# 2 pos. in cts for kinematics
// Status Flags
#define Mtr1HmComp M145 ; Motor #1 Home-complete bit (suggested M-variable)
#define Mtr2HmComp M245 ; Motor #2 Home-complete bit (suggested M-variable)
#define CS1_RunTimeError M5182 ; Coordinate System 1 run-time-error bit (suggested M-variable)
Mtr1HmComp->Y:$0000C0,10,1 ; #1 Home-complete bit
Mtr2HmComp->Y:$000140,10,1 ; #2 Home-complete bit
CS1_RunTimeError->Y:$00203F,22,1 ; &1 Run-time-error bit
310 Kinematics
Turbo PMAC Training
Forward/Inverse Kinematics
Undefine all
&1 ; Addressing Coordinate System 1
Close
// ======================================================================================== //
Xsq_p_Ysq=KinPosX*KinPosX+KinPosY*KinPosY
TempCosB=(Xsq_p_Ysq-L1sq_p_L2sq)/(2*Length1*Length2)
If (ABS(TempCosB)<0.9998) ; Valid solution with 1 degree error?
Q0=KinPosX ; Q0 is atan2 function denominator, KinPosY is numerator
TempA=atan2(KinPosY)-acos((Xsq_p_Ysq+L1sq_s_L2sq)/(2*Length1*sqrt(Xsq_p_Ysq)))
TempB=acos(TempCosB)
Mtr1Pos=Mtr1SF*TempA
Mtr2Pos=Mtr2SF*TempB
Else
CS1_RunTimeError=1 ;Abort and set runtime if impossible solution
Endif
Close
// ======================================================================================== //
311 Kinematics
Turbo PMAC Training
Motion Program
Rectangular Trajectory (inside valid tool tip range)
End Gat
Del Gat
Close
X 2 Y 0 ; Go to X=2 Y=0
Dwell 0 ; Stop 0 msec, stop blending
X 4 Y 0 ; Go to X=4 Y=0
Dwell 0 ; Stop 0 msec, stop blending
X 4 Y 3 ; Go to X=4 Y=3
Dwell 0 ; Stop 0 msec, stop blending
X 2 Y 3 ; Go to X=2 Y=3
Dwell 0 ; Stop 0 msec, stop blending
X 2 Y 0 ; Go to X=2 Y=0
Dwell 1000 ; Wait for 1000 msec
Close
Turbo PMAC Script
312 Kinematics
Turbo PMAC Training
Position Reporting PLC
PLC Position Reporting prevents potential overlapping use and register
conflicts for reporting (Watch Window, reporting to host, etc.)/plotting
purposes. Do not use P1-P32 or Q1-Q9 in this PLC:
#define Actual_X P1001
#define Actual_Y P1002
#define Actual_A P1003
#define Actual_B P1004
#define Actual_Mtr1Pos M162
#define Actual_Mtr2Pos M262
#define CMD_X P2001
#define CMD_Y P2002
#define CMD_A P2003
#define CMD_B P2004
#define CS_Number P2005
#define CMD_Mtr1Pos M161
#define CMD_Mtr2Pos M261
#define Length1 Q91 ; Linkage 1 length (inches)
#define Length2 Q92 ; Linkage 2 length (inches)
#define Mtr1SF Q93 ; Motor#1 Scale Factor, Counts/User units (deg)
#define Mtr2SF Q94 ; Motor#2 Scale Factor, Counts/User units (deg)
Actual_Mtr1Pos->D:$8B
Actual_Mtr2Pos->D:$10B
CMD_Mtr1Pos->D:$88
CMD_Mtr2Pos->D:$108
313 Kinematics
Turbo PMAC Training
Example Test Result
Using the Plot Tool to plot Commanded and Actual XY position
314 Kinematics
Turbo PMAC Training
Velocity Kinematics
Forward
Kinematics Motion Program
Motor Axis
Commanded
Velocity Velocity
Axis Velocity
Inverse
Kinematics
315 Kinematics
Turbo PMAC Training
Reserved Variables for Velocity
Calculations
¾ If Kinematic Subroutines are used, the following P-Variables and Q-Variables are
reserved for velocity calculations in Kinematic Subroutines:
P101 through P132 are reserved for velocities of motor 1 through 32
Q10 is reserved to indicate when to use velocity kinematics
=0 when PVT not in use
=1 when PVT in use
Q11 through Q19 are reserved for axis speeds in each coordinate system as follows:
Reserved Axis Reserved Axis Reserved Axis
Q-Variable Letter Q-Variable Letter Q-Variable Letter
Q11 A Q14 U Q17 X
Q12 B Q15 V Q18 Y
Q13 C Q16 W Q19 Z
Forward
Kinematic
Subroutines
Motor Velocity Axis Velocity Motion Program
Commanded
P101 to P132 Q11 to Q19 Axis Velocity
Inverse
Kinematic
Subroutines
316 Kinematics
Turbo PMAC Training
Velocity Kinematics Example
Example: 2-axis shoulder-elbow (SCARA) robot.
Tool tip is defined in XY coordinates
A and B are defined as angles in degrees
L1 = 4 inches, L2 = 3 inches
Y
[X,Y] & = −L A
X & & & ( )
1 sin (A ) − L 2 A + B sin (A + B )
B & =L A
Y & cos(A ) + L A
1 2 (
& +B )
& cos(A + B)
L2
L1 A [
&B = L2 X cos ( A + B ) + Y sin ( A + B )
& & ]
X L1 L2 sin (B )
& − XX& − YY&
A=
L1 L2 sin (B )
Example Velocity Kinematics Code:
See Turbo PMAC User Manual, pp 265-266.
317 Kinematics
Turbo PMAC Training
PMAC Position Compare
What is Position Compare?
¾ Provides a fast (MHz sampling rate, output rise time in nanoseconds) and accurate
digital output on the EQUn pin of the Servo I.C. in use, where n is the channel number
of the position compare in use
¾ Output is based on the actual position counter – when the hardware counter in the I.C.
becomes equal to the compare register, the output toggles immediately
¾ Often, this output is used to trigger a measurement device or to fire a laser, for
example
¾ Hardware function – no delays in capture; accurate to exact count
¾ Can set up to output a single pulse at a specified capture position, or automatically
increment the capture position to continue to give pulses at programmed intervals
M112=1 M111=1
Turbo PMAC Script
¾ The EQU1 state should now be high; i.e., M116=1 and the EQU1 pin should be putting
+5 V out
320
Turbo PMAC Training
Manually Controlling EQUn Output
¾ Reset the output to zero by typing this in the Terminal Window:
M112=0 M111=1
Turbo PMAC Script
¾ The EQU1 state should now be low; i.e., M116=0 and the EQU1 pin should be putting 0
V out
¾ It can be useful to control the state of EQUn manually using synchronous M-Variables
in a motion program
Now just set PA and enable the PLC whenever you want to calculate PE!
324 Position Compare
Turbo PMAC Training
Step 2: Writing to Compare Registers
¾ The EQUn compare output will toggle at Compare A (the front end) and toggle again at
Compare B (the back end)
Thus if EQUn started low, it would be high for the whole region between Compare A and
Compare B, and vice versa
¾ Determine the axis positions at the front and back ends, and then use the process in
Step 1 to convert to encoder values
¾ Then, write the result of the front end into Compare A and the result of the back end
into Compare B
Home
Switch
Location
Stage with
Instrument 3.0” Lead Screw
¾ At 1 rev/inch and 2000 cts/rev, 1.5” will be 3000 cts, but since Ixx26 is in units of 1/16
counts, we need to multiply by 16. Type into the Terminal:
I126 = -3000*16 ; Motor 1 home offset (1/16 cts)
Turbo PMAC Script
¾ To make sure the stage starts out at the zero position, type into the Terminal:
#1HM ; Home motor 1
Turbo PMAC Script
¾ Right-click the window and select “Position and Velocity Units”, and select 2000 Cts
Per Unit with 3 Decimal Places, Position Units of “in”, Time Units of sec, Velocity Units
of in/sec, and then click “Apply”. This will produce inches as the unit for Motor #1
Now write the values to Compare A (Mxx08) and Compare B (Mxx09) and zero the Auto-
Increment register (Mxx10) as follows in the Terminal Window:
¾ The value set Mxx12 is set once the user sets Suggested M-Variable Mxx11=1
¾ In this example, the Pitot tube centerline starts below the 4” mark
¾ Want the instrument to be OFF outside the 4”-10” region, and ON inside it, so one
must set EQUn low initially by typing this into the Terminal Window:
M112=0 M111=1
Turbo PMAC Script
End Gat
Del Gat
Close
&1
Undefine All
#1->2000X
X 12
Dwell 0
CMD"End Gat"
Dwell 0
Close
Turbo PMAC Script
Add this to the code from the previous slide and run it by typing into the Terminal #1J/ &1
B1 R. Watch M116 in the Watch window to see it alternate as the motor moves.
0.9
X-Axis Commanded Position [inches]
10
0.8
6 0.5
0.2
2
0.1
0 0
0 0.5 1 1.5 2 2.5 3
Time [sec]
Add this code to that of the previous page, and then run the PLC by typing #1J/ Enable
PLC 1 in the Terminal Window.
0.9
X-Axis Commanded Position [inches]
10
0.8
0.4
4
0.3
0.2
2
0.1
0 0
0 0.5 1 1.5 2
Time [sec]
3. Write the encoder value at the front edge of the position compare interval into
“Compare A” register (Suggested M-Variable Mxx08) and the back edge of the
position compare interval minus the auto-increment value into “Compare B” register
(Suggested M-Variable Mxx09)
¾ Using this feature, one can automatically activate the output of EQUn at regular
intervals instead of needing to set up the single pulse repeatedly
This example assumes that PLC 2 (the example PLC given earlier
used to convert Axis Position to Encoder Position) with its associated
Macro definitions is still in PMAC.
Note
Mxx10
B0 A0 B1 A1 X-Axis [in.]
12
2” 2.5” 3.5” 4”
0 Laser will be
ON in this
Mxx08: region
Back
Mxx09 = B1 − Mxx10
Front edge of Front edge
edge of first of next
Mxx09 first lasing lasing
lasing region region
Laser region
starting
point
¾ At 1 rev/inch and 2000 cts/rev, 1.5” will be 3000 cts. Type into the Terminal:
I126 = -3000 ; Motor 1 home offset (cts)
Turbo PMAC Script
¾ To make sure the stage starts out at the zero position, type in the Terminal:
¾ Now move the stage such that the laser begins between 2” (B0) and 2.5” (A0) before
activating the position compare. Type into the Terminal:
¾ Thus, Mxx10 must be set such that when the encoder reaches the front edge, the
Mxx09 will be incremented so that the back edge is in the correct location to form the
end of the active region
¾ In our example, Mxx10 needs to be set to 1.5” to accomplish this. Type into the
Terminal:
M110 = 1.5*2000 ; Set Auto-Increment register (1.5 in. *2000 cts/in = 3500 cts)
Convert the Axis Position directly to Encoder Position using only the
axis scale factor (FS) for Mxx10 because it is an incremental value;
i.e., the home offset terms are not needed because Mxx10 is relative to
terms (Mxx08 and Mxx09) that consider them already.
Note
¾ Set Mxx09 equal to the encoder position value of the back edge of the first active
region minus Mxx10
Mxx09 = B1 − Mxx10
Compare B Back edge of first active
region Auto-Increment Value
¾ The value set Mxx12 is set once the user sets Suggested M-Variable Mxx11=1
¾ In this example, the laser centerline starts below the 2.5” mark
¾ Want the instrument to be OFF outside the first region, and ON inside it
(X [2.5”,3.5”)), so one must set EQUn low initially by typing this into the Terminal
Window:
M112=0 M111=1
Turbo PMAC Script
¾ Want to set the jog to be only 2.0 inch/second to completely perforate the paper with
the laser, which is 8 cts/msec, to which one should set I122
End Gat
Del Gat
Close
&1
Undefine All
#1->2000X
Add this to the code from the previous slide and run it by typing into the Terminal #1J/
&1 B2 R. Watch M116 in the Watch window to see it alternate as the motor moves.
6 0.5
0.4
4
0.3
0.2
2
0.1
0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time [sec] X-Axis Cmd. Pos.
M116 (EQU1 Output)
&1
Undefine All
#1->2000X
CMD"#1J=4500"
; Jog to 2.25 inches
I5111=10*8388608/I10 While(I5111>0) EndW ; 10 msec delay
While(M133=0 or M140=0) EndW ; Wait for jog to complete (status bits are set)
PA = 2.5
Enable PLC 2 I5111=10*8388608/I10 While(I5111>0) EndW ; Wait for PLC 2 to run
Mtr1PosCompA = PE
PA = 3.5
Enable PLC 2 I5111=10*8388608/I10 While(I5111>0) EndW ; Wait for PLC 2 to run
Mtr1PosCompB = PE - Mtr1AutoInc
Put all the code from this and the previous two slides together, download to PMAC, then run by
typing #1J/ Enable PLC 2 into the Terminal Window. You can monitor the EQU1 output
by watching M116 in a Watch Window.
6 0.5
0.4
4
0.3
0.2
2
0.1
0 0
0 0.5 1 1.5 2 2.5 3
Time [sec] X-Axis Cmd. Pos.
M116 (EQU1 Output)
355
Turbo PMAC Training
Closed Loop Servo
Desired Position (Motion Program Input)
Desired Velocity (±10V)
Desired Torque (± 10V)
Desired Phase Current (Sine Wave)
Desired PWM Values (1 to 15 kHz)
+
+ A
Trajectory Position + Velocity Current Power Current
Generator
Commutator + - B
- Filter - Filter Filter Block C Sensors
Interpolation -
ADC
d
dt
ADC
Load
Load Position
(Position) (Velocity) (Torque) (Commutation) (PWM) Feedback
PMAC2
PMAC
SMCC
MCC PWM
Amplifier
MACRO
SERCOS
Classic Amplifier
356
Turbo PMAC Training
Tasks in Different Types of Amplifiers
1. Closing position loop (always inside controller)
2. Closing velocity loop
3. Commutation
4. Closing current loop
5. Powering (always inside amplifier)
¾ Velocity-loop parameters are load dependent and must be set by machine builder
¾ 3-phase voltage commands sent to amplifier, encoded as top & bottom PWM pairs
362
Turbo PMAC Training
Electromagnetic Force
S
(South Pole)
Conductor
B (Armature)
(Magnetic Field) i
L F (Force)
N
(North Pole)
F = (i × B )L
363 Commutation
Turbo PMAC Training
DC Brush Motor Commutation
¾ Commutation occurs automatically inside the motor by mechanical brushes passing over
the coils on the rotor
¾ Field on stator, Armature on rotor
Stator (Field)
Stator (Field)
N
N Rotor (Armature)
N Rotor (Armature)
N
Commutator
S (Brush)
S
S
S
DC Brush DC Brush
(Permanent Magnet) (Wound Field)
364 Commutation
Turbo PMAC Training
DC Brushless (AC Synchronous)
Motor Commutation
Phase A
Ia Stator (Armature)
Rotor (Field)
N
Phase B
S
Ib Ic=-(Ia+Ib)
Phase C
Id
Rotor
Iq Angle DC Brushless
Ib
Ic (3 Phase,1 Pole Pair)
Ia Itotal
Id (Magnetization Current) = 0
Iq (Quadrature current) = Desired Torque
Park-Clark Phasing : To find rotor magnetic orientation
Transformation (Rotor Angle)
365 Commutation
Turbo PMAC Training
3-Phase, 2-Pole Pairs Commutation
A A A A A A A
C
C
C
B
B
C
C
C
B
B
A A A A A A A
B Off Off
Low Low
High High
C Off Off
Low Low
Phase A Phase A
Ia
Phase B Phase B
N
Ib
S
Phase C Phase C
Ic
AC Induction AC Induction
Stationary (No Current) Rotating (Current Induced)
367 Commutation
Turbo PMAC Training
AC Induction Vector Analysis
¾ No permanent magnet on rotor, No phasing
¾ Direct current (Ixx77) needed for magnetizing rotor conductors
¾ Slip Frequency Gain (Ixx78) : Difference between input phase frequency and mechanical
rotation frequency
Ia
Id Rotor
Ib Iq Angle
Ic
Ia Itotal
Ib Ic=-(Ia+Ib)
Park-Clark
Transformation
Id (Magnetization Current) ≠0
Iq (Qaudrature current) = Desired Torque
368 Commutation
Turbo PMAC Training
AC Induction Setup
¾ Two Methods (Refer to Geo Brick User Manual):
No Encoder (Micro-Stepping), with Encoder
¾ Ixx77 is set to achieve desired Torque and Speed
369 Commutation
Turbo PMAC Training
Stepper Motor
370 Commutation
Turbo PMAC Training
PMAC/PMAC2 Commutation with
Analog Current Loop
DC AC
Magnetization
I d' I a' + Va va
Current DAC PI PWM
Direct Current
Ix77 Command dq - Ia
to
Phase A Current Loop
abc
I q'
Torque Command I b' + Vb vb
from Position/ DAC PI PWM E
Velocity Servo Quadrature
- Ib
Current Command
Θe -
Phase B Current Loop -
Ixx78 SG -
- Vc vc
PWM
- +
+ Balance Loop
Θr
1/s
+
PMAC Amplifier
371 Commutation
Turbo PMAC Training
PMAC2 Commutation with Digital
Current Loop
DC AC
Vd va
Id + + Va
Magnetization
Current Direct Current PI PWM
Ix77 Command - -
dq Vb vb
to E
P PWM
abc
Vq Vc
vc
PWM
Direct Current Loop
Θ
Iq + + Id Ia ia
from Position/ PI ADC
Velocity Servo Quadrature
Current Command - abc
-
P to
Iq dq Ib ib
ADC
Quadrature Current Loop
Θe
+ + Θr
SG 1/s
Ixx78
PMAC Amplifier
372 Commutation
Turbo PMAC Training
PMAC2 Digital PWM Generation (Per
Phase)
New Command Loaded
Ixx66 at Counter Turnaround
I7m00+1
PWM
Command
PWM PWM
Command Counter
Range Range Time
Servo
4 x I7m00+6
Interrupt
PWM_CLK Generated
Cycles PWM
Up/Down Here
Counter Clock is 120MHz Counter
-I7m00-2
-Ixx66
PWM
Top Signal
PWM
Bottom Signal
Deadtime
(I7m04)
373 Commutation
Turbo PMAC Training
PMAC Position Following
What is Position Following?
¾ PMAC can tell one motor to follow the encoder of another motor to try to match its
position
¾ The commanded position of the follower motor follows the actual position of the
master motor
¾ Can adjust Ixx07 and Ixx08 of each motor to create an electronic gearing relationship
Ixx06
$3501-$35C0 Can be
Ixx07 changed
on the fly
Trajectory
Command CP + + FE + To DAC
Ixx08 PI
Can be changed on
- -
Should not be
the fly, but doing so is AP changed on Actual
not suggested for D the fly Motor
inexperienced users Position
Ixx09
Ixx08
Actual
Load
Position
2. Set Ixx05 of the follower equal to the Processed Data Address of the encoder
conversion table (ECT) entry of the master (must be an X register).
3. Set Ixx06 = 1 to enable normal mode following or set Ixx06 = 3 to enable offset mode
following.
4. Set Ixx07, Motor xx Master Scale Factor, to the desired value (application dependent)
for electronic gearing.
5. Set Ixx08, Motor xx Position Scale Factor, to the desired value (application
dependent) for electronic gearing.
⎛ Ixx07 ⎞
follower
ΔPf = ⎜ ⎟ΔPm
⎝ Ixx08 ⎠
Position change of master
¾ For this position-following function, Ixx07 and Ixx08 can be thought of as the number
of teeth on meshing gears in a mechanical coupling.
¾ Ixx07 may be changed on the fly to permit real-time changing of the gear ratio, but
Ixx08 may not (unless the user modifies the servo loop gains on the fly as well, but
doing so while the servo loop is closed is not recommended).
¾ Ixx08 should therefore be set to a large enough value to get the required resolution of
ratio changes.
If the user changes Ixx08 or Ixx09, the user must retune Kp and Kd,
respectively. The motor could behave erratically if not retuned.
WARNING
Ixx08old Ixx08new
K p ,new = K p ,old K d , new = K d , old
Ixx08new Ixx08old
Ixx09old
K d , new = K d , old
Ixx09new
These modifications are only if the user wants to preserve the tuning
that existed before configuring the Master/Follower setup; i.e.,
alternatively, the user can manually retune all of the servo
algorithm’s gains after enabling following.
Note
382 PMAC Position Following
Turbo PMAC Training
Position Following Setup Example
¾ In this example, motor 2 is following motor 1 using Normal Mode settings with a gear
ratio of 2 master revolutions to 1 follower revolution:
#define MaxSF 8388607 ; Maximum scale factor value
#define PrevIxx08 P133 ; Store previous Ixx08 for user calculations
#define PrevIxx09 P134 ; Store previous Ixx09 for user calculations
#define RatioIxx08 P135 ; Ratio of new Ixx08 over old Ixx08
#define RatioIxx09 P136 ; Ratio of new Ixx09 over old Ixx09
#1k#2k ; Kill motors 1 and 2
I205=@I8000 ; Set motor 2 to use ECT output of motor 1’s
; 1/T extension entry at its master position
I206=1 ; Enable normal following for motor 2
I207=MaxSF/2056 ; Set master scale factor to 1/2056 max scale factor
PrevIxx08=I208 ; Store previous I208 value
PrevIxx09=I209 ; Store previous I209 value
I208=I207*2 ; Set follower scale factor to 2*master S.F.
; This allows follower displacement to be 1/2 the master
; displacement
I209=I208 ; Set Ixx09=Ixx08 since Ixx03=Ixx04
RatioIxx08=I208/PrevIxx08 ; Compute ratio of old to new Ixx08
RatioIxx09=I209/PrevIxx09 ; Compute ratio of old to new Ixx09
I230=I230/RatioIxx08 ; Retune Kp
I231=I231*RatioIxx08/RatioIxx09 ; Retune Kd
Turbo PMAC Script
¾ Can filter some of this noise with encoder conversion table-based filters, but
generally one should use time-based slaving instead if master motor has a noisy
encoder signal
¾ Can also assign two motors identical axis definitions and have PMAC compute the
moves for each motor identically (Coordination)
This takes slightly more computational power but can be less noisy than position following
388
Turbo PMAC Training
Axis Matrix Transformation
Y
Scaling
Y'
X
X'
θ, Rotation
Displacement
¾ Once the transformation is defined, every move thereafter will be forced to go through
the transformation; i.e., PMAC will transform the X, Y, Z positions the user programs
and then commands the motors using the transformed vectorial result
¾ Specification
Motor 1 for X Axis, and Motor 2 for Y Axis
Starting from origin
Set (X,Y)=(1,0) as the corner of the first (0.5)*(0.5) square and cut it
Rotate the square clockwise for 45º, 90º, and 135º (45º apart) and cut
Go back to origin at the end of every move
0.5
¾ Specification
From previous example, after the first cut shape, translate and rotate the cut
shape simultaneously.
Incremental displacement: [-0.5, 0, 0]T
Incremental rotation: 45º apart
Y 1 1.5
0.5
¾ The operating principle of Time Base Control is to replace time with master position to
create a position vs. position trajectory function
¾ The relationship between real time and the nominal master position is called the Real-
Time Input Frequency (RTIF).
¾ RTIF (cts/msec): nominal speed of master position (i.e. when Feedrate = 100%)
Velocity
TM
RTIF = 2 cts/msec
Time (msec)
TA TA
0 500 1000 1500
Master Position (cts)
0 1000 2000 3000
IF
%= × 100
RTIF
¾ % Feedrate of a time-base-controlled coordinate system is determined by the
IF/RTIF ratio, which means that when the master is speeding up, the motion of that
coordinate system will also speed up accordingly
¾ Question:
How does PMAC use this information to change %Feedrate?
On power-on, reset ($$$), or commanding %100, the value of I10 will be copied once
to the addresses specified by Isx93, Coordinate System x Time Base Control Address.
Let the value in Isx93 address be VIsx93, and then the Feedrate value is determined by
the following equation:
VIsx93
%= × 100
I10
If Isx93 is pointing to an address which contains the value of the related calculation
result from IF and RTIF, then the Feedrate will change according to that result.
VIsx93 IF IF ⋅ I10
= ⇒ VIsx93 =
I10 RTIF RTIF
399 Time Base Control
Turbo PMAC Training
RTIF and TBSF
N
2
TBSF =
RTIF
A machine needs to be built to periodically cut a web of material moving on a conveyor belt.
The cutting speed needs to be proportional to the belt speed in order to cut correctly. Thus,
one can make the cutting action (slave) look to the encoder on the belt as the master position
register in order to proportionally change the speed that the cutter moves.
¾ Determines how PMAC interprets the passage of time based off of the master
position
¾ E.g., if RTIF = 32 cts/msec, 32 cts of the master position register must elapse for
PMAC to think that 1 msec has elapsed
¾ Use RTIF to derive the Time-Base Scale Factor (TBSF) in units of msec/count,
which one puts into the Time-Base Encoder Conversion Table Entry
350 inch 1 min 500 lines 4 counts 1 second 1 rev = 0.619 cts/ms
1 min 60 sec 1 rev 1 line 1000 ms 6π inch = RTIF
N
2
TBSF =
RTIF
where N = 17 for normal time-base
N = 14 for triggered time-base
4. Adjust programmed motion times based on the differences between desired RTIF
and computed TBSF by using the Move Time Scale Factor (MTSF - see slide after
next)
1. Must be an integer.
2. This must hold:
2 ⋅ ( fs ) N
TBSF <
max[ f i ]
where N = 17 for normal time-base
N = 14 for triggered time-base
fs = Servo Frequency [Hz]
fi = Input Frequency [cts/sec] (the speed at which Master
Position is changing)
¾ Neglecting to do this will cause your move times to be incorrect by the percentage
amount that you rounded the TBSF to make the TBSF value an integer
Download
Entry when
Finished
Time-base ECT entries occupy two lines. This is why Isx93 points to
@I8005 here rather than @I8004.
Note
412 Time Base Control
Turbo PMAC Training
Setting Isx94
¾ Isx94 - Coordinate System x Time Base Slew Rate
¾ Defines the maximum rate at which the % value can slew to the new hardware-
determined value and the actual rate of change is determined by the hardware.
¾ Wait 500 ms
// Motor Settings
I422 = 0.619 ; Nominal web speed (cts/msec)
I116 = 100 ; Max cutter speed (cts/msec)
I117 = 2 ; Max cutter accel. (cts/msec^2)
¾ Configure the trigger with Ixx97, Ixx25, I7mn2, I7mn3, and Ixx12
¾ Must freeze the time base from within the motion program until the appropriate time to
start waiting for the trigger
¾ A PLC then arms the time-base to start waiting for the trigger
¾ Once the trigger initiates, the time-base control continues just like in the normal time-
base configuration
See the “Triggered Jog Moves (Homing)” section of the Turbo PMAC
Training to learn how to configure hardware and software triggers.
Note
Download
Entry when
Finished
Time-base ECT entries occupy two lines. This is why Isx93 points to
@I8005 here rather than @I8004.
Note
420 Time Base Control
Turbo PMAC Training
Freezing and Arming Time-Base
¾ The motion program must freeze the time-base and wait until it is appropriate to enter
the time-base control mode
¾ A PLC must arm the time-base to begin waiting for the trigger from the master once
the appropriate time has come
¾ Point an M-Variable to bits 20-24 of the ECT entry input address
Example: If Time-base ECT Entry is Entry 5:
M199->Y:$3505,20,4 ; Time-base control address is input of entry 5 of ECT
Turbo PMAC Script
¾ The A axis must wait for the index pulse of the master and 45 degrees past it
¾ Must accelerate up to top speed over the next 36 degrees of the master, run at speed
for 144 degrees of the master, and decelerate over 36 degrees of the master
Hardware:
Rotary Axis Encoder: 500 lines/rev
Load Gearing: 3:1
Master Encoder: 500 lines/rev on Servo I.C. 2 Channel 4
Typical Rotation Rate: 60 rpm
¾ Now follow the same steps used for normal time base to compute TBSF and MTSF:
// Macro Definitions
#define RTIF P400
#define MTSF P401
#define Two_to_the_N P402
#define TBSF P403
#define the_N P404
#define Rounded_TBSF P405
#define Vd P406 ; Motor #4 nominal speed [deg/msec]
// Time base setting calculations
the_N = 14 ; for triggered time-base
I422 = 60/60*500*4/1000 ; cts/msec
RTIF = I422 ; cts/msec – matches base jog speed of motor 4
Two_to_the_N = Exp(the_N*Ln(2)) ; Raises 2 to the power of 17
TBSF = Two_to_the_N/RTIF ; Time base scale factor
Rounded_TBSF = Int(TBSF + 0.5) ; Round to integer
MTSF = 1+(1-Rounded_TBSF/TBSF) ; Move time scale factor
Undefine All
&2 ; Address Coordinate System 2
#4->X ; Put the Master Motor into a different coordinate system than the slave
End Gat
Del Gat
Close
Open Prog 12 Clear
Enable PLC 10
While(M11=1) ; While machine input 1 is high
Dwell 0 ; Stop lookahead in program
M199=$9 ; Freeze time-base
Dwell 0
Linear ; Linear move mode
Inc ; Incremental move specification
TA(36/Vd) ; 36 degrees of master takes (36/Vd) msec
TS 0 ; No S-curve
Delay(45/Vd*MTSF) ; 45 degrees of master takes (45/Vd) msec
TM((36+144)/Vd*MTSF) ; 36+144 deg of master takes ((36+144)/Vd) msec
A 360 ; One full revolution of slave axis (deg)
EndWhile
Disable PLC 10
Close
Turbo PMAC Script
End Gat
Del Gat
Close
I5=2 ; Permit background PLCs to run
Open PLC 10 Clear
If (M199=$9) ; Has time-base been frozen?
M199=$B ; Then arm for trigger
EndIf
Close
Turbo PMAC Script
¾ Now start motor 4 jogging by typing #4J+ in the Terminal Window, and then start the
program by typing #1J/ &1 B12 R in the Terminal Window
¾ Try changing I422 and then issuing #4J+ again to observe how the rotation rate of
motor #1 changes proportionally
¾ When violation is detected, motion is slowed at problem point without altering the
position trajectory
¾ Algorithm recalculates motion leading up to problem point to keep all motion within
limits
To set the I-Variables in Steps 1-2, please refer to the Turbo SRM, as
this procedure is just an outline. The Turbo SRM gives extensive
descriptions of each variable as well as how to set each variable
mentioned in the setup steps here.
Note
Typical values of Isx13 for segmentation mode are 5 to 20 msec, integer values only
The smaller the value, the tighter the actual motor position will fit to the commanded position
trajectory, but the more computation is required for the moves, and the less is available for
background tasks
If Isx13 is set too low, Turbo PMAC will not be able to do all of its move calculations in the
time allotted, and it will stop the motion program with a run-time error
Coordinate System x
Lookahead Length
4⎛ ⎡ Ixx16 ⎤ ⎞
[# segments]
⎜⎜ max ⎢ ⎥ ⎟⎟
3⎝ ⎣ Ixx17 ⎦ xx ⎠
Isx 20 =
(2)(Isx13)
Segmentation Time [ms]
¾ Size the lookahead buffer to hold this number of segments plus the number of segments
through which one desires to reverse
NR =
Isx13 ⋅ max[ Ixx16]xx ⋅ K
Conversion factor from
counts to user units (user unit/ct)
¾ Minimum number of total segments (NT ) needed for the lookahead buffer is then:
N T = N R + Isx 20
433 PMAC Lookahead
Turbo PMAC Training
Defining the Lookahead Buffer
Then, use NT when defining the lookahead buffer:
¾ Deletion process:
Del Rot
Del Gat
Del Comp
Del Look
Turbo PMAC Script
Undefine All
/******************************Setup and Definitions*************************/
&1 ; Enter coordinate system 1
#1->1000X ; Assign motor 1 to X axis; 1000 cts = 1 user unit
#2->1000Y ; Assign motor 2 to Y axis; 1000 cts = 1 user unit
I5049 = 10 ; gather every 10 servo cycles
I5000 = 1 ; Store gather in RAM and do not permit wrap-around
I5113 = 5 ; Enable segmentation; compute every 5 ms
I5192 = 0 ; Enable blending
I116 = 50 ; Set motor 1 max vel. to 50 ct/s
I117 = .5 ; Set motor 1 max accel. to 50 ct/s^2
I216 = 50 ; Set motor 2 max vel. to 50 ct/s
I217 = .5 ; Set motor 2 max accel. to 50 ct/s^2
I5120 = 4/3/2*I116/I117/I5113 ; Compute number of lookahead segments needed
End Gat
Del Gat
Del Rot
Del Comp
Del Look
Close
Define Lookahead 13,50 ; Define lookahead buffer based on the number in I5120
PMAC Lookahead
Lookahead Example Program
Add this to the code from the previous slide:
/****************************Motion Program********************************/
Open Prog 1 Clear
Home 1,2 ; Home motors 1 and 2
Linear Abs ; Set linear absolute move
CMD"End Gat" ; End gathering
CMD"Del Gat" ; Delete contents of gather buffer
CMD"Def Gat" ; Define gather buffer
Dwell 0
CMD"Gat" ; Begin gathering
Dwell 0
F 50 X 10 Y 10 ; Feedrate 50 user units/sec, move X 10 and Y 10 user units
X 0 Y 20 ; Move to X 0 and Y 20 user units
Dwell 0 ; Do not blend to next command
CMD"End Gat" ; End gathering
Dwell 0 ; Do not blend to next command
Close
Turbo PMAC Script
Now run the program by typing #1J/#2J/ &1 B1 R in the Terminal Window
Without 30
10
15
units/sec]
units]
Mtr. 1 Cmd. Pos.
0
Mtr. 2 Cmd. Pos.
Mtr. 1 Cmd. Vel.
10
Mtr. 2 Cmd. Vel. -10
-20
5 Motor 2 slows
-30
down for the
0 -40 corner. Total move
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time [sec]
time is longer, but
commanded
25 40 position trajectory
is identical.
With 30
Lookahead: 20
15
10
Mtr. 1 Cmd. Pos.
units/sec]
Mtr. 2 Cmd. Pos.
units]
-10
5
-20
0
-30
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
-5 -40
Time [sec]
¾ Gather and plot position and velocity data for motors 1 and 2
¾ Now compute the Isx20 you need and define an appropriate lookahead buffer using
Isx13 = 5 (ms); e.g.:
Define Lookahead 273, 50 ; Buffers 273 blocks and 50 synchronous M-Variables
¾ Subroutine:
A line or set of lines within a motion program
A motion program can call a subroutine repeatedly using the GoSub command within the
motion program and jumps back to the command immediately following the GoSub when
Return is encountered
¾ When a repetitive task needs to be repeated; one can just call a subprogram or
subroutine each time, rather than rewriting the same motion lines repeatedly
¾ When a modular program is needed that has reusable subroutines that can receive
arguments
¾ When one wants to use PMAC just like a CNC tool, sticking to standard G-Code
definitions
The machine tool designer writes Program 1000 to implement the G-Codes as he or she
wishes, allowing customization and enhancements.
Delta Tau provides a sample file implementing all of the standard G-Codes.
¾ GoSub{data} – Go to line in {data} in the same motion program; return to the line
following GoSub after encountering Return
¾ GoTo{data} – Go to line in {data} in the same motion program and continue on;
does not return to line following the GoTo after encountering Return
Example
Open Prog 10 Clear
Call300 ; Calls program 300, starting at the beginning of the program
Call800.00100 ; Calls program 800, starting at line N100
Call32.00001 ; Calls program 32, starting at line N1
Close
Turbo PMAC Script
¾ Read{data} – Reads arguments passed to it via the Call command. Each argument must
be a letter, and each argument’s value is then put into a Q-Variable, starting with A at Q101,
B at Q102, etc., excluding N and O. E.g.:
Close
Turbo PMAC Script
¾ GoSub 300
Jumps to: N 300 of same motion program,
¾ Call 500
Jumps to: Prog 500, at the top (N0)
¾ Call 500.1
Jumps to: Prog 500, label N10000
¾ Call 500.12
Jumps to: Prog 500, label N12000
¾ Call 500.12345
Jumps to: Prog 500, label N12345
¾ On-line command B700
Points to: Prog 700, N0, ready to run
¾ On-line command B700.34
Points to: Prog 700, N34000, ready to run
Z Y F E D C B A Letter
0 0 0 1 1 0 0 0 Q100
25 24 5 4 3 2 1 0 Bit #
25 24
2 2 32 16 8 4 2 1 Bit Value (Dec)
2000000 1000000 20 10 8 4 2 1 Bit Value (Hex)
M 3 is equivalent to
CALL 1001.03000
T 01 is equivalent to
CALL 1002.01000
D 12 is equivalent to
CALL 1003.12000
¾ Then, part programmers and machine operators can treat system as regular “G-Code”
machine
¾ Prog 1000 and up can be password protected to protect proprietary code from
unauthorized access
Put this code into the same file as the code given on the previous page;
it all belongs together.
Note
452 Subprograms and Subroutines
Turbo PMAC Training
G Code Program Example
Now run the program by typing &1 B5 R in the terminal window. If you want, you can
gather the positions of motors 1 and 2 to see a plot with the following motion profile:
60000
Motor 2 Actual Position [cts]
50000
40000
30000
20000
10000
0
0 5000 10000 15000 20000 25000 30000 35000 40000
Motor 1 Actual Position [cts]
Position Compensation
Standard Lead Screw compensation
Cross-axis compensation
2D planar compensation
Backlash Compensation
Position error depends on motor direction
Defined by Ixx85, Ixx87, and the table
Torque Compensation
Compensate servo output as a function of position
COMMAND:
Define Comp 200,#1,#1,10000
Δx Δx Δx Δx
M Table Length
Source Motor
Target Motor
Table Span (cts)
COMMAND:
Define Comp 100,#1,#2,10000
Note:
If Source and Target motors are the same,
M Δy Δy Δy Δy Command can also be:
y, #2
x, #1 Δz
Position 0 500 1000 1500 2000 2500 3000 3500 4000 (cts)
Position Error 0 -10 5 7.5 5 0 -5 -2.5 0 (cts)
Note:
Corrections between entry counts are linearly interpolated.
Compensation table will roll over after 4000 counts.
Note:
With an implied correction value of 0 for the
zeroth entry, Rows 0 and 4 are identical,
as are Columns 0 and 5.
Implied correction value 0
¾ Example:
Count span
Number of entries
Define backlash compensation
Motor number
Position
Position
Position
¾ Compensation Results
Actual velocity Following Error Command
Before Compensation After Compensation
Turbo Clipper
PeWin32Pro2
Turbo PMAC VME UMAC
Please let the instructor know if you have any additional questions
about the training topics or about your application before you leave.
APPENDIX
The following example code is for exercises in the Final Program and PLCs Exercises section
starting on page 285.
467 Appendix
Turbo PMAC Training
Exercise 2: Indexing a Motor
End Gather
Delete Gat
Close
&1
#1->10000X ;I 2000*5 cts for 1 cm
Open Prog 1 Clear ;1
Home 1 ;2 Home motor #1
CMD"Def Gat" ;3 Define Gathering Buffer
Dwell 0
CMD"Gat" ;4 Start Gathering
Dwell 0
Linear ;5
Abs ;5
TM 900 ;6
TA 100 ;7
X 10 ;8 Move to 10 user units (cm)
Dwell 4000 ;9 Wait for 4 sec
TM 1900 ;10
TA 100
X 20 ;11 Move to 20 user units (cm)
Dwell 1000 ;12 Wait for 1 sec
TM 1400 ;13
TA 100 ;13
X 0 ;14 Move to origin in 1.5 sec
CMD"End Gat" ;15 End Gathering
Close ;16
M7000->Y:$078C00,0,1 ;Input 0 of ACC-11E
P7000=M7000 ;I Latch P7000 to initial M7000 value
Open PLC 1 Clear ;1
If (M7000=1 and P7000=0) ;2
CMD"%50" P7000 = 1 ;3&4 Issue feedrate override and latch P7000
Else If (M7000=0 and P7000=1);5
CMD"%100" P7000 = 0 EndIf ;6&7 Restore feedrate and delatch P7000
EndIf
Close ;8
468 Appendix
Turbo PMAC Training
Exercise 3: Conditional Branching
Undefine All
End Gat
Del Gat
Close
&1
#1->10000X ;I 2000*5 cts for 1 cm
Open Prog 1 Clear ;1
Home 1 ;2 Homing the motor #1
CMD"Def Gat" ;3 Define Gathering Buffer
Dwell 0
CMD"Gat" ;4 Start Gathering
Dwell 0
Linear ;5
Abs ;5
F 1 ;6 Move at rate of 1 user unit/sec
X 10 ;7 Move 10 user counts (cm)
Dwell 1000 ;8 Wait for 1 sec
X 0 ;9
Dwell 100 ;10
CMD"End Gat" ;11 End Gathering
Close ;12
469 Appendix
Turbo PMAC Training
Exercise 3: Conditional Branching
Open Prog 2 Clear ;1 Open PLC 1 Clear ;1
Home 1 ;2 Home motor #1 If (M7000=1 and M7001=0 and Latch1=0);2
CMD"Def Gat" ;3 Define Gat Buffer CMD"B1 R“ ;3
Dwell 0 Latch1=1 ;4
CMD"Gat" ;4 Start Gathering If(Latch2=1) ;5
Dwell 0 Latch2=0 ;6
Linear ;5 EndIf
Abs ;5 EndIf
F 2 ;6 If(M7000=0 and M7001=1 and Latch2=0) ;7
X-10 ;7 Move 10 user counts (cm) CMD"B2 R“ ;8
Dwell 1000 ;8 Wait for 1 sec Latch2=1 ;9
X 0 ;9 If(Latch1=1) ;10
Dwell 100 ;10 Latch1=0 ;11
CMD"End Gat" ;11 End Gathering EndIf
Close ;12 EndIf
#define Latch1 P8000 ;I
#define Latch2 P8001 ;I If(M7000=1 and M7001=1) ;12
Latch1=0 Latch2=0 ;II Assume 0 initially I5111=100*8388608/I10 ;13
While(I5111>0) EndWhile ;13
EndIf
Turbo PMAC Script If(M7000=0 and M7001=0) ;14
I5111=100*8388608/I10 ;15
While(I5111>0) EndWhile ;15
EndIf
Close ;16
Turbo PMAC Script
Put this code before that code when copying to your Editor Window.
470 Appendix
Turbo PMAC Training
Exercise 4: X, Y Plotter
End Gat
Del Gat
Close
M7000->Y:$078C00,0,1 ;Input 0
M7024->Y:$078C03,0,1 ;Output 0
&1
#1->2000X ;I 2000 cts for 1 inch
#2->2000Y ;II 2000 cts for 1 inch
Open Prog 1 Clear ;1
Linear ;2
Abs ;2
X 0 Y 0 ;3 Move to (0,0)
F 1 ;4 Feedrate of 1 user unit per second
CMD"Def Gat" ;5 Define Gathering Buffer
Dwell 0
CMD"Gat" ;6 Start Gathering
Dwell 0
X 10 Y 0 ;7 Move to (10,0) user counts (inch)
X 10 Y 10 ;8 Move to (10,10) user counts (inch)
X 0 Y 10 ;9 Move to (0,10) user counts (inch)
X 0 Y 0 ;10 Move to (0,0) user counts (inch)
X 10 Y 10 ;11 Move to (10,10) user counts (inch)
Dwell 0
CMD"End Gather" ;12 End Gathering
M7024=0 ;13
Close ;14
M7000->Y:$078C00,0,1 ; Input 0
M7024->Y:$078C03,0,1 ; Output 0
P7000=M7000 ;I Latch P7000 to initial value of M7000
Open PLC 1 Clear ;1
If (M7000=1 and P7000=0) ;2
CMD"B1 R" P7000=1 ;3,4 Run motion program 1 and latch P7000
M7024=1 Else If(M7000=0 and P7000=1) P7000=0 EndIf ;5,6,7 Delatch P7000
EndIf
Close ;8
471 Appendix
Turbo PMAC Training
Exercise 5: Mixed Move Modes
Undefine All
&1
#1->1000X ;I
#2->1000Y ;I
#3->1000Z ;I
; #4 will be cutter, jogging
I5113 = 5 ;II Enable segmentation, with 5 ms segmentation time
I5192 = 0 ;III Enable blending
472 Appendix
Turbo PMAC Training