Cross-Coupled Drive of Dual-Motor Gantry System Usually, the control of the multi-motor gantry system is done by either the classic master-slave or the full coordination method on PMAC. In this application note, a cross-coupled method for controlling dualmotor gantry system is presented. Cross-Coupling When cross-coupled, the feedback from the two gantry motors, X1 and X2, are used to create two control axes in PMAC. One of which is the summation of the two feedback, X. The other is the subtraction of one of the feedback from the other, C a. The trajectory command will be generated directly for these two control axes. The control outputs from the PID will then be de-coupled into two components, UX1 and UX2, one for each motor. The following shows a schematic diagram of the Cross-coupled method. From the above diagram, the relationship between X1, X2, X a and C a is given by the following equations: For a gantry system, the control target would be: X a = X 1 + X 2 Ca = X 1 X 2 X d = 2xDesiredPosition C d = 0 Hardware Setup There are some special requirements for connecting the gantry motors to PMAC. 1. Four motor channels are required to use with the two gantry motors. Two of them are connected physically to the motors (amplifiers). Two are used for de-coupling of the control signal. The two physical motor channels must be the higher number channels. For example, if motor channel 1 to 4 are used in the application, the gantry motors should be connected to channel 3 and 4. 2. Three encoder channels are required to create the cross-coupled feedback in PMAC. Two of them would be the direct feedback of the gantry motors. The third one should be connected to the feedback device of one of the gantry motors in a reverse sense. For quadrature encoder, this could be done by swapping the A and B channels to PMAC. Gantry with Cross Coupling 1
PMAC Setup The following is an example of setting the coordinate system, encoder conversion table and I-Variables for such application in PMAC. This example assumes the gantry motors are connected to PMAC channel 3 and 4. The direct feedback of the encoders are brought to PMAC through encoder channel 3 and 4 and the reversed feedback signal of the second gantry motor is brought in through encoder channel 2. The following diagram illustrates the setup of this example in PMAC. Note that one of the PID loops must be given a negative proportional gain value (Ix30). As a result, the firmware version 1.16 or later is required. In this example, the I430 variable is set to a negative value. For any hardware setting which is different from this example, refer to the diagram given above for correct loop gain setting. In addition, the Proportional Gains (Ix30) acting on the Error signal from the C axis loop (motors #2 and #4 in the above example), must be twice the Ix30 values acting on the Error signal from the X axis loop (motors # 3 and #1 in the above example). This is required so that the DAC signals sent to the amplifiers reflect both traverse and skew correction. Coordinate System Definition &1 #1->X #2->C #3->X #4->C Encoder Conversion Table Setup WY$720,$C008 ;Feedback of X1 WY$721,$1C00C ;Add to X2 WY$722,$C008 ;Feedback of X1 WY$723,$1C004 ;Add to X3 (i.e. -X2) WY$724,$0 ;End of conversion table I-Variables Setup Not all the I-Variable setup for PMAC is included. The proportional gain (Ix30) value given below is solely for illustrative purpose, the actual value in the system should be the one obtained from tuning. I102 = $F9 ;Output to #4 DAC offset ;For PMAC2, I102 = $FD I103 =$721 ;Use (X1+X2) feedback I104 =$721 I130 =350000 ;Positive proportional gain (half i230 & i430) I202 = $BD ;Output to #3 DAC offset ;For PMAC2, I202 = $C1 2 Gantry with Cross Coupling
I203 =$723 I204 =$723 I230 =700000 I302 = $C00B I303 = $721 I304 = $721 I330 = 350000 I402 = $C00A I403 = $723 I404 = $723 I430 = -700000 ;Use (X1-X2) feedback ;Positive proportional gain ;Output to #3 DAC ;For PMAC2, I302 = $C012 ;Use (X1+X2) feedback ;Positive proportional gain (half i230 & i430 ;Output to #4 DAC ;For PMAC2, I402 = $C01A ;Use (X1-X2) feedback ;Negative proportional gain A sample program for commanding this system is given below. This program will move the gantry system to a position of 10000 units from the current position. OPEN PROG 1 CLEAR LINEAR ;Linear mode move INC ;Incremental mode TA10 ;10 msec. acceleration time TM1000 ;1 sec. move time X20000 C0 ;command move = 2*desired position DWELL0 Homing PLC The homing PLC is intended to use with the cross-coupled gantry system. Some of the parameters setup here is a continuation of the cross-coupled gantry system. The command involved in the homing PLC and the setup section may not be applicable to all systems. Check the logic and modify it as needed. Setup Encoder Conversion Table WY$720,$C008 ;Feedback of X1... WY$721,$1C00C ;Add to feedback of X2 WY$722,$C008 ;Feedback of X1... WY$723,$1C004 ;Add to feedback of X3 (i.e. -X2) WY$724,$C008 ;Encoder 3 - feedback of X1 WY$725,$C00C ;Encoder 4 - feedback of X2 WY$726,$0 ;End of conversion table Setup Master Address, Ix05 and Ix06, for Slaving to Actual Position I305 = $725 I306 = 0 I405 = $724 I406 = 0 Setup Homing Parameters, Ix23 and Ix26 This section definitely needs changes according to the true system. Because of the uncertainty in the position of each motor at power up, it is suggested to set the home offset at least equal to the sum of the maximum skewness and the distance between the home switch. I323 = 5 I326 = 0 I423 = 5 I426 = 0 Result of Encoder Conversion Entry M1->X$721,0,24,S M2->X$723,0,24,S M3->X$724,0,24,S M4->X$725,0,24,S Gantry with Cross Coupling 3
Open Loop Indication Bit, Mx38 M138->X$3D,18,1 M238->X$79,18,1 M338->X$B5,18,1 M438->X$F1,18,1 In-position Bit, Mx40 M340->Y$994,0,1 M440->Y$A54,0,1 Home Complete Bit, Mx45 M345->Y$994,10,1 M445->Y$A54,10,1 Present Actual Position Mx62 M162->D$002B M262->D$0067 M362->D$00A3 M462->D$00DF Previous Actual Position, Mx98 M198->Y$2A,0,24,S M298->Y$66,0,24,S M398->Y$A2,0,24,S M498->Y$DE,0,24,S Previous Velocity Position, Mx99 M199->Y$31,0,24,S M299->Y$6D,0,24,S M399->Y$A9,0,24,S M499->Y$E5,0,24,S Avoid PLC0 to Start Running at Power up I5 = 2 OPEN PLC 1 CLEAR Kill All Gantry Motors CMD^K WHILE (M138=0 OR M238=0 OR M338=0 OR M438=0) Disable Master Slave I306=0 I406=0 De-couple the Gantry System I102=$C003 I202=$C002 I303=$724 I304=$724 M398=M3 M399=M3 I403=$725 I404=$725 M498=M4 M499=M4 Set Back I430 to Positive Value or Change I915 to 3 or 7 to Reverse Polarity I430=ABS(I430) ;i915=7 Put Some Delay before Motor Re-enable P1000 is an Arbitrary Choose P-Variable P1000=0 WHILE (P1000<2000) P1000=P1000+1 4 Gantry with Cross Coupling
Home Motor #3 First close position loop on motor #4 CMD"#4J/" WHILE (M438=1) Put Motor #4 Slaving to Motor #3, Then Home Motor #3 I406=1 M345=0 CMD"#3HM" WHILE (M345=0 OR M340=0) Put Motor #4 as Master and Motor #3 as Slave, then Home Motor #4 I406=0 I306=1 M445=0 CMD"#4HM" WHILE (M445=0 OR M440=0) Disable Master Slave I306=0 Jog Motor #3 Back to Zero Position to De-skew the System CMD"#3J=0" P1000=0 WHILE (P1000<1000 OR M340=0) P1000=P1000+1 DIS PLC 0 I5=3 Reset Control Flag (P1001) and Wait for PLC 0 to Finish P1001=0 ENA PLC 0 WHILE (P1001=0) I5=2 DIS PLC 1 OPEN PLC 0 CLEAR Cross-couple the Gantry System I102=$F9 I202=$BD I303=$721 I304=$721 I403=$723 I404=$723 I430=-1*ABS(I430) Zero out the Position of Motor #1 & #2, then put them in Closed Loop The following assignments are equivalent to CMD"#1HMZ#2HMZ" M162=0 M262=0 M362=0 M462=0 M198=M1 M199=M1 M298=M2 M299=M2 M398=M1 M399=M1 M498=M2 M499=M2 CMD"#1j/#2j/" Set Control Flag P1001=1 DIS PLC 0 Gantry with Cross Coupling 5