Application Example 0018

Application Example 0018
Position Servo Sample Program - Advanced Indexing Table
Concept:
This sample program demonstrates the use of the PositionServo Drive in an Indexing (Rotary) Table example
application.
The code executes a programmed homing routine on start up, and then waits for Indexing instructions from a Human
Machine Interface (HMI), PLC, PC, or other communications Master before performing the instructed Index Moves.
The Communications Master (hereafter referred to as the Controller) writes to a variable inside the PositionServo. The
PositionServo detects the change in this variable and immediately indexes to the new Position. The Controller sends
positional commands in degrees between 0 and 360, referred from the home position of the indexing table.
The indexing table must move in the Forward Direction only due to losses (backlash) in the gearbox used.
The time between motion commands is determined by the controller as it has supervisory input from the Pick/Place
Mechanics (refer to Figure 1).
The controller requires the PositionServo to keep a count of how many Indexes have been performed. An indexing
table is illustrated in Figure 1.
Pick / Place
Mechanics
Rotation
Home Activation
Home Switch
PositionServo
Controller
Communications Link
Index Commands
Figure 1: Indexing Table
The program uses the Enable Input on A3 as a Run/Stop input to the Drive.
Input B1 provides a system Reset for the Indexing Table. When this input is activated the drive will be disabled,
position registers reset to 0 and the program will begin again with the homing routine.
Input B2 provides the homing sensor for the homing routine.
1
AE0018A
Copyright © 2010 by Lenze AC Tech Corporation
www.lenze-actech.com
For general information only. Content subject to change without notice.
January 2010
1-508-278-9100
Application Example 0018
The PositionServo is placed in Position Mode with internal reference selected through the relevant variables at the
start of the program. The Enable switch is set to inhibit functionality in the same way.
In order to maintain constant positioning accuracy a variable within the drive (V2) is used to store the target position
of each subsequent index move. This removes any positioning error between the previous and next positioning move
of the index table. This variable is reset with the system reset input (B1).
Variable V3 stores the Last Index Position that was commanded so that it can be compared to the next (New) position
command by the controller. The Position Servo detects the change and uses the variable as part of the calculation of
the next (forward) move.
Variable V4 stores the Next Index Position to be performed. The controller writes the value directly to V4. The
PositionServo identifies the change in V4 as a request to move to a new position and will execute that motion.
Variable V5 provides a counter for the number of indexes that have been performed. This variable is only reset on
power off/on. It could be read and stored permanently in the non-volatile memory of the controller if required and
written back to the drive on power up. It could also be written to the EPM of the drive periodically by the controller so
it is stored permanently on power down.
Variable V6 is used to signal to the outside world that the indexer table has finished positioning to the next Index.
It is switched off when a new Position move is about to be executed and switched on when the move is completed
successfully.
An event is used to detect the system reset input. This event will cause the drive to disable and program execution
to restart from the beginning.
No subroutines are used in this example.
Motor Mechanics:
The Indexing Table is fitted with a 54 to 1
gearbox onto which the motor is connected.
The indexing table rotates through the full
360 degrees. The Controller needs to specify
indexing in degrees ranging from 0 to 360.
Units in this application are therefore set to
0.15 (54/360).
Index Move
(Commanded by Controller)
V4
(Next Position)
Home Position
Wait Time
(Defined by Controller)
Rotation
Due to mechanical losses (backlash) in the
gearbox and the precision required in the
application, the indexing table is required
to index in the forward direction only once
homing is completed. System variables and
mechanics are shown in Figure 2.
Gearbox 54 1
Units = 0 15
Figure 2: System Variables
2
AE0018A
Copyright © 2010 by Lenze AC Tech Corporation
www.lenze-actech.com
For general information only. Content subject to change without notice.
January 2010
1-508-278-9100
Application Example 0018
Fault Handling:
In the event of a fault, the code will be restarted. The operator must switch the drive Enable/stop input (A3) off and
on again for the program loop to restart. Homing will be performing again immediately following reset from a fault
condition.
I/O:
IN_A3: Safety Enable / stop - Connected to machine safety Guards/Devices
IN_B1: System Reset
IN_B2: Homing Sensor
Connection:
Safety Stop
System Reset
Homing Sensor
6
+5V INT
5
GND
26
IN_A_COM
29
IN_A3
31
IN_B_COM
32
IN_B1
33
IN_B2
PositionServo P3
Figure 3 illustrates the P3 terminals that need to be connected for this example to work.
Figure 3: Connection Diagram- Advanced Indexing Table
3
AE0018A
Copyright © 2010 by Lenze AC Tech Corporation
www.lenze-actech.com
For general information only. Content subject to change without notice.
January 2010
1-508-278-9100
Application Example 0018
Example Program:
The program code is color-coded for quick recognition of the various parts of the indexer program. The color coding
is not in accordance with, or representative of, any national or international standard.
;******************************** PositionServo User Indexing Program ***************************************
;********************************************** Header ********************************************************
;Title
: Indexing Table - Advanced Feed Forward - PositionServo Training Program
;Author
: AC Technology International Ltd
;Description
: Program is for an Indexing Table that is allowed to travel Clockwise Only.
;
: The Size of the Steps taken by the Indexer is sent from a HMI or PC over Communications
;
: The Sequence of Moves is Random and Sent from the Controller following completion of
;
: the Previous Index. A Basic Indexing Program example is also available.
;Version Number : V1.0.1
;Date
: 23/04/07
;
;************************************************ I/O List **************************************************
; Input A1
- not used
; Input A2
- not used
; Input A3
- Run / Safety stop (Disable)
; Input A4
- not used
; Input B1
- System Reset
; Input B2
- Homing Sensor
; Input B3
- not used
; Input B4
- not used
; Input C1
- not used
; Input C2
- not used
; Input C3
- not used
; Input C4
- not used
;
; Output 1
- not used
; Output 2
- not used
; Output 3
- not used
; Output 4
- not used
;
; Analog In 1 - not used
; Analog In 2 - not used
; Analog Out - not used
;
; Encoder Out - not used
;
;
;
;******************************** Initialize and Set Variables ************************************************
; Define Constants and Variables. Assign I/O and Initialize Variable Values
UNITS = 0.15
Accel = 50
Decel = 50
MaxV = 50
; Units in Degrees (Gearbox 54:1)
; Set Acceleration Ramp Rate for Position Mode Moves
; Set Deceleration Ramp Rate for Position Mode Moves
; Set Velocity for Position moves
VAR_REFERENCE = 1
VAR_ENABLE_SWITCH_TYPE = 0
VAR_DRIVEMODE = 2 ; Set Reference to Internal
; Enable switch function set to “Inhibit”
; Set Operating mode to Position mode
Define True 1
Define False 0
; Allow ‘True’ Keyword to be Used in Logic
; Allow ‘False’ Keyword to be Used in Logic
Define Safety_Stop_Input IN_A3
Define System_Reset IN_B1
Define Homing_Sensor IN_B2
; Define Logical (System / Application specific) Name for Input A3
; Define Logical (System / Application specific) Name for Input B1
; Define Logical (System / Application specific) Name for Input B2
Define Target_Position V2
Define Previous_Position V3
Define Next_Position V4
Define Sequence_Counter V5
Define Position_Out V6
; Define Variable to Incremented with New Index Positions (Used in MoveP)
; Define a Variable to Store the Previous Index Position
; Define a variable to Store Next (Commanded) Index Position (Written by Controller)
; Define a Variable to Count Indexes Performed (Pass to HMI if Required)
; Define a Variable to Indicate to Controller that Indexing is Completed / in Progress
4
AE0018A
Copyright © 2010 by Lenze AC Tech Corporation
www.lenze-actech.com
For general information only. Content subject to change without notice.
January 2010
1-508-278-9100
Application Example 0018
;************************************************ Events ******************************************************
;Event to Check for the system Reset Button Being Pressed
Event Reset_Restart Input System_Reset Rise Jump Program_Start
; Restart Program from Program_Start Label
Endevent ;Event to Check for New Position being Loaded from Controller
Event New_Index Next_Position <> Previous_Position Jump Program_Loop
; Restart Program from Program_Start Label - Execute Move
Endevent ;******************************************* Main Program *****************************************************
Wait Until Safety_Stop_Input == False
; Ensure safety Input is Safe Before Starting Program
PROGRAM_START: Event New_Index
Off
Disable
Event Reset_Restart On
; Turn off Event that Causes Indexes to be Executed (Ensure Off)
; Disable Drive (Ensure Disabled following System Reset Input going High)
; Turn on Event to detect a system Reset (Input) Occurring
APOS = 0
; Initialise APOS as 0
Wait While Safety_Stop_Input == False ; Ensure saftey Input is Active Before Starting Program
Enable
; Enable Drive / Goto Run
Target_Position = 0
Previous_Position = 0
Next_Position = 0
Position_Out = False
; Reset the Target Position (Tracking) Variable
; Reset the Previous Position Variable
; Reset the Next Position Variable
; Switch off the ‘In Position’ Output
Homing:
; Homing Routine, Performed at Start Up and after Homing Routine Request input goes high
Maxv = 10
; set slow velocity for homing
Move back until Homing_Sensor
; move back at slow velocity until homing sensor is activated
Maxv = 2
; set very slow velocity
Move until homing_sensor == 0
; move forward off homing sensor
APOS = 0
; Set actual position register to 0 Maxv = 50
; Set velocity back to normal speed
Event New_Index On Halt
Program_Loop: Event New_Index Off
; Halt Program Execution - to be Restarted by Event (New Position Loaded)
; Turn off Event to Check for further Motion Commands Until Current Move Completed
If Next_Position > Previous_Position ; If New Position is ahead of Previous Position (0-360 degrees rotation)
Target_Position = Target_Position + (Next_Position - Previous_Position)
; Increment Current Position by the Difference of the 2 Variables
EndIf If Next_Position < Previous_Position ; If New Position is Behind Previous Position (0-360 degrees rotation)
Target_Position = Target_Position + (360 - Previous_Position + Next_Position)
; Increment Current Position by the difference between 360 degrees and
; the current position and then add next position (Feed Forward only!)
EndIf Position_Out = False
; Switch off the ‘In Position’ Variable - Indication to Controller
MoveP Target_Position, S
; Implement / Apply the Next Index Step - Use S-Ramp for Softer Positioning
Position_Out = True
; Switch on the ‘In Position’ Variable - Indication to Controller
Sequence_Counter = Sequence_Counter + 1
; Increment Sequence Counter for the Last Index Step Performed
Previous_Position = Next_Position
; Update Previous Position with Next_Position now Move Completed
Event New_Index
On
; Turn on Event to Detect for Next Index Command from Controller
Halt
; Halt Program Execution - to be Restarted by Event (New Position Loaded)
Fault_Reset: wait until Safety_Stop_Input == False ; Wait until Drive run input is disabled
Goto Program_Start 5
AE0018A
Copyright © 2010 by Lenze AC Tech Corporation
www.lenze-actech.com
For general information only. Content subject to change without notice.
January 2010
1-508-278-9100
Application Example 0018
;******************************************* Sub-Routines *****************************************************
; Enter Sub-Routine code here
;************************************** Fault Handler Routine *************************************************
; Enter Fault Handler code here
ON FAULT Resume Fault_Reset
; Jump to Fault Handler Section
ENDFAULT 6
AE0018A
Copyright © 2010 by Lenze AC Tech Corporation
www.lenze-actech.com
For general information only. Content subject to change without notice.
January 2010
1-508-278-9100