Walkthrough: Problem 13: Workpiece Alignment

Difficulty

Target behavior

With the start button, coordinate the 3 servo axes, cylinder, suction pad, and rotary table to take the 3 workpieces from the supply tray, turn them on the rotary table, and line them up on the discharge tray

What you will learn

  • How to build a long sequence of more than 20 steps
  • Repeating an operation with a workpiece number (DM)
  • Automatic operation and cycle stop
  • First scan pulse (CR2008)

Problem

This model transfers workpieces using three servo motor axes.

It is close to real equipment and requires complex control. It is a difficult problem, but give it a try!


Pick up a workpiece with the suction pad, rotate it 90° on the rotary table, and carry it to the discharge tray.



The following points are registered for the three servo motors.

AxisPoint No.Position [mm]Speed [mm/s]Acceleration [mm/s²]Description
Axis 1 Supply125100400Workpiece 1 to the pick-up position
280100400Workpiece 2 to the pick-up position
3135100400Workpiece 3 to the pick-up position
Axis 2 Transfer14200800Above the supply tray (pick-up position)
2239200800Above the rotary table
3474200800Above the discharge tray (place position)
Axis 3 Discharge1135100400Left pocket of the discharge tray to the place position
280100400Center pocket of the discharge tray to the place position
325100400Right pocket of the discharge tray to the place position

The relays used to control each of the three axes are as follows. Operation enable, forced stop, and operable are shared by all axes.

See the description of Problem 12 for how to use each relay. In the U_WRPPNT and U_RDAERC instructions, specify 1 to 3 as the axis number.

Name (all axes)DirectionRelay
Operation enableOutputR0
Forced stopOutputR2
OperableInputR6600
NameDirectionAxis 1 SupplyAxis 2 TransferAxis 3 Discharge
Servo ONOutputR305R705R1105
Servo readyInputR6905R7305R7705
Homing requestOutputR310R710R1110
Homing completeInputR6910R7310R7710
Positioning startOutputR200R600R1000
Positioning start acknowledgedInputR6800R7200R7600
Axis busyInputR6903R7303R7703
Positioning completeInputR6802R7202R7602
Positioning complete clearOutputR202R602R1002
Axis errorInputR6900R7300R7700
Axis error clearOutputR300R700R1100

Target behavior (video)

Approach

This is a comprehensive problem that combines everything learned so far (step control, suction/vacuum break, rotary table, positioning). For one workpiece, do "take it from the supply tray → place it on the rotary table → rotate 90° → pick it up again → place it on the discharge tray", and repeat this 3 times while changing the workpiece number DM0 from 1 → 2 → 3.

Axes and points

AxisRolePoints
Axis 1 SupplyMoves the supply tray to bring workpiece N to the pick-up positionP1 to P3 = workpieces 1 to 3
Axis 2 TransferCarries the suction head left and rightP1 above the supply tray / P2 above the rotary table / P3 above the discharge tray
Axis 3 DischargeMoves the discharge tray to bring pocket N to the place positionP1 to P3 = pockets 1 to 3

The relays of axis n are the axis 1 numbers plus 400×(n−1) (e.g. servo ON: axis 1 R305 / axis 2 R705 / axis 3 R1105).

Process table (steps)

StepDescriptionCondition to advanceMain outputs
MR0PreparingMR30 running, X1 raised end, R6600 operable, 3 axes servo ready-
MR1HomingHoming complete on 3 axesR310/R710/R1110 ON
MR2Cycle startMR30 running (DM0 +1)-
MR3Supply axis to workpiece NAxis 1 start ack + positioning completeAxis 1 → P[DM0]
MR4Transfer axis to pick-up positionAxis 2 start ack + positioning completeAxis 2 → P1
MR5Pick-up loweringX0 lowered endY0 ON
MR6Pick-up suctionX2 suction confirmedY0 ON, Y1 SET
MR7Pick-up raisingX1 raised end-
MR8Transfer axis to rotary tableAxis 2 start ack + positioning completeAxis 2 → P2
MR9Place on table: loweringX0 lowered endY0 ON
MR10Place on table: releaseT0 0.5 s and X2 OFFY0 ON, Y1 RES, Y3 ON
MR11Place on table: raisingX1 raised end-
MR12Rotate 90°X4 after rotationY2 SET
MR13Pick from table: loweringX0 lowered endY0 ON
MR14Pick from table: suctionX2 suction confirmedY0 ON, Y1 SET
MR15Pick from table: raisingX1 raised end-
MR16Rotate back / discharge axis to pocket NAxis 3 complete and X3 before rotationY2 RES, Axis 3 → P[DM0]
MR17Transfer axis to place positionAxis 2 start ack + positioning completeAxis 2 → P3
MR18Place on discharge tray: loweringX0 lowered endY0 ON
MR19Place on discharge tray: releaseT1 0.5 s and X2 OFFY0 ON, Y1 RES, Y3 ON
MR20Place on discharge tray: raisingX1 raised end → MR2 if DM0 is 1 or 2 / MR21 if 3-
MR21All workpieces done--

Based on this approach, try writing the ladder yourself first.
In the simulator, you can create the wiring and ladder and actually run the 3D equipment model.

Try it in the simulator
Show the sample ladder and explanation(click to open)

Devices used

DeviceComment
Inputs
X0Cylinder lowered end
X1Cylinder raised end
X2Suction confirmed
X3Before rotation
X4After rotation
X5Start
X6Stop
Outputs
Y0Cylinder down
Y1Vacuum valve
Y2Rotary table rotate
Y3Vacuum break valve
Internal relays
MR0Preparing
MR1Homing
MR2Cycle start (waits here when stopped)
MR3Supply axis to workpiece N
MR4Transfer axis to pick-up position
MR5Pick-up lowering
MR6Pick-up suction
MR7Pick-up raising
MR8Transfer axis to rotary table
MR9Place on table: lowering
MR10Place on table: release
MR11Place on table: raising
MR12Rotate 90°
MR13Pick from table: lowering
MR14Pick from table: suction
MR15Pick from table: raising
MR16Rotate back / discharge axis to pocket N
MR17Transfer axis to place position
MR18Place on discharge tray: lowering
MR19Place on discharge tray: release
MR20Place on discharge tray: raising
MR21All workpieces done
MR30Automatic operation
Timers
T0Place on table: release wait
T1Place on discharge tray: release wait
Data memory
DM0Workpiece number
Positioning unit
R0Operation enable
R200Axis 1 Positioning start
R305Axis 1 Servo ON
R310Axis 1 Homing request
R600Axis 2 Positioning start
R705Axis 2 Servo ON
R710Axis 2 Homing request
R1000Axis 3 Positioning start
R1105Axis 3 Servo ON
R1110Axis 3 Homing request
R6600Operable
R6800Axis 1 Positioning start acknowledged
R6802Axis 1 Positioning complete
R6905Axis 1 Servo ready
R6910Axis 1 Homing complete
R7200Axis 2 Positioning start acknowledged
R7202Axis 2 Positioning complete
R7305Axis 2 Servo ready
R7310Axis 2 Homing complete
R7600Axis 3 Positioning start acknowledged
R7602Axis 3 Positioning complete
R7705Axis 3 Servo ready
R7710Axis 3 Homing complete
Special relays
CR2002Always ON
CR2008First scan ON

Ladder explanation

The row numbers in the figures match the row numbers in the simulator's ladder window.

1InitializationRows 001–006

  • Row 002: CR2008 (first scan pulse) is a special relay that is ON only for the first scan after RUN starts. It SETs the first step MR0 (preparing).
  • Rows 003–006: always ON outputs operation enable R0 and servo ON for the 3 axes (R305/R705/R1105).

2Automatic operation and cycle stopRows 007–009

MR30 (automatic operation) holds itself with start X5, and the hold is broken by the N.C. contact of stop X6. It is the self-holding circuit of Problem 2 with a stop condition added.

MR30 is checked in only two places: "preparing → homing" and "cycle start → next workpiece". So even if stop is pressed midway, the workpiece being carried is placed first, and the machine stops at the cycle start (MR2) (cycle stop). Pressing start again resumes from the next workpiece.

3Step transitions ①: preparing, homing, cycle startRows 010–017

  • Rows 011–012: if start is pressed while preparing, the cylinder is at the raised end, the unit is operable, and all 3 axes are servo ready, go to homing. The cylinder is raised before moving the axes so that the suction pad does not hit anything.
  • Rows 013–014: when homing is complete on all 3 axes, go to cycle start
  • Rows 015–017: at cycle start, if running, go to the supply axis move, and at the same time add 1 to the workpiece number with INC DM0 (0 → 1 for the first workpiece)

4Step transitions ②: take from the supply tray and move to the rotary tableRows 018–031

  • MR3→MR4: the supply axis has reached workpiece N (R6800, R6802)
  • MR4→MR5: the transfer axis has reached above the supply tray (R7200, R7202)
  • MR5→MR6→MR7: lower → suction → raise (same as Problem 8)
  • MR7→MR8→MR9: after raising, move the transfer axis above the rotary table, then lower when it arrives
  • MR9→MR10: at the lowered end, go to suction release

As in Problem 12, positioning completion is judged by both "start acknowledged" and "positioning complete".

5Step transitions ③: turn it on the rotary table and pick it up againRows 032–043

  • MR10→MR11: after 0.5 seconds of vacuum break (T0) and the workpiece coming off (X2 OFF), raise (same as Problem 9)
  • MR11→MR12: at the raised end, rotate the table 90°
  • MR12→MR13: when after-rotation X4 turns ON, lower again
  • MR13→MR14→MR15→MR16: suction → raise

Rotation is done only while the head is at the raised end, so the suction pad and workpiece do not collide.

6Step transitions ④: place on the discharge tray and go to the next workpieceRows 044–055

  • MR16→MR17: proceed when both the rotary table return (before rotation X3) and the discharge axis move to pocket N (R7600, R7602) are finished. The two motions are done at the same time to save time.
  • MR17→MR18→MR19→MR20: transfer axis above the discharge tray → lower → vacuum break
  • Rows 052–053: at the raised end, if DM0 is 1 or 2, go back to cycle start MR2 for the next workpiece
  • Rows 054–055: if DM0 is 3, go to all workpieces done MR21

Row 052 places = DM0 1 and = DM0 2 in parallel (OR) with a vertical line.

7Homing and the supply axisRows 056–062

  • Rows 057–059: during the homing step, turn ON the homing requests of the 3 axes
  • Rows 061–062: the supply axis uses U_WRPPNT 1 DM0, using the value of the workpiece number DM0 directly as the point number. If DM0 is 1 it goes to P1, if 2 to P2, and so on, so the same ladder handles all 3 workpieces.

8Transfer axis and discharge axisRows 063–072

  • Rows 064–066: set the transfer axis point according to the step: P1 (above supply tray) / P2 (above rotary table) / P3 (above discharge tray)
  • Rows 067–069: during the transfer axis move steps, turn positioning start R600 ON
  • Rows 071–072: like the supply axis, the discharge axis selects the pocket by the value of DM0 and moves

9Up/down cylinderRows 073–081

Y0 (cylinder down) is ON during the 8 steps of lowering and working at the lowered end (suction, release). In other steps it is OFF and the cylinder rises.

10Suction pad and rotary tableRows 082–091

  • Rows 083–084: SET the vacuum valve Y1 in the two suction steps
  • Rows 085–086: in the two release steps, RES Y1 and turn the vacuum break valve Y3 ON
  • Rows 087–088: each release step counts 0.5 seconds with its own timer, T0/T1
  • Rows 090–091: SET Y2 in the 90° rotation step and RES it in the rotate-back step

The sample wiring and ladder data can be downloaded fromGitHuband loaded with "Load wiring" and "Load ladder" in the simulator.

Key points

  • Even in a long sequence, the pattern is just a repetition of "current step and completion condition → SET next, RES current". Making a process table (like the one above) before writing the ladder prevents missing steps and ordering mistakes.
  • For repeated operations, keeping a number in a DM and using it as the point number etc. saves you from adding more ladder.
  • The timer is split into T0 and T1 instead of sharing one across two steps because writing TMR with the same device in two places is a double coil.