Motion Axis Position Cam (MAPC)
CompactLogix
5380, CompactLogix
5480, ControlLogix
5580, Compact GuardLogix
5380, and GuardLogix
5580 controllersThe Motion Axis Position Cam (MAPC) instruction provides electronic camming between any two axes according to the specified Cam Profile.
When executed, the Slave axis is synchronized to the designated Master axis by using a position Cam Profile established by the
Studio 5000 Logix Designer
application Cam Profile Editor or Motion Calculate Cam Profile (MCCP) instruction. The instruction also provides an easy means to cancel a running position cam anywhere during the cam execution and replace it with a different profile. The replacement is done immediately or is scheduled at a specific Master position along the running cam.
This is a transitional instruction. Follow these steps when using it:
- In ladder logic, insert an instruction to toggle the rung-condition-in from false to true each time the instruction should execute.
- In a Structured Text routine, insert a condition for the instruction to cause it to execute only on a transition.
Architecture | Standard | Safety |
---|---|---|
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers | Yes | No |
Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers | Yes | No |
Available Languages
Ladder Diagram
Function Block
This instruction is not available in function block.
Structured Text
MAPC (SlaveAxis, MasterAxis, MotionControl, Direction, CamProfile, SlaveScaling, MasterScaling, ExecutionMode, ExecutionSchedule, MasterLockPosition, CamLockPosition, CamType, MasterReference, MasterDirection);
Operands
Ladder Diagram and Structured Text
Operand | Type Tip: AXIS_CONSUMED is supported by Compact GuardLogix 5580, CompactLogix 5380, and CompactLogix 5480 controllers only. | Type Tip: AXIS_GENERIC is supported by the ControlLogix 5570 and the GuardLogix 5570 controllers only. | Format | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Slave Axis | AXIS_CIP_DRIVE AXIS_VIRTUAL | AXIS_CIP_DRIVE AXIS_SERVO AXIS_SERVO_DRIVE AXIS_GENERIC AXIS_GENERIC_DRIVE AXIS_VIRTUAL | Tag | The axis to which the cam profile applies. Ellipsis launches the Axis Properties dialog. For controllers that support the REF_TO motion data types, the supported axis operand type can be replaced by an equivalent REF_TO type. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Master Axis | AXIS_CIP_DRIVE AXIS_CONSUMED AXIS_VIRTUAL AXIS_SERVO AXIS_SERVO_DRIVE CompactLogix 5370, Compact GuardLogix 5370, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480 | AXIS_CIP_DRIVE AXIS_CONSUMED AXIS_GENERIC_DRIVE AXIS_VIRTUAL AXIS_SERVO AXIS_SERVO_DRIVE | Tag | The axis that the Slave axis follows according to the cam profile. Ellipsis launches the Axis Properties dialog. If Pending is selected as the Execution Schedule, then Master Axis is ignored. For controllers that support the REF_TO motion data types, the supported axis operand type can be replaced by an equivalent REF_TO type. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Motion Control | MOTION_INSTRUCTION | MOTION_INSTRUCTION | Tag | Structure used to access block status parameters. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Direction | DINT | DINT | Immediate | Relative direction of the Slave axis to the Master axis: 0 = Same – The Slave axis position values are in the same sense as the Master’s. 1 = Opposite – The Slave axis position values are opposite sense of the Master’s. 2 = Reverse – The current or previous direction of the position Cam is reversed on execution. When executed for the first time with Reverse selected, the control defaults the direction to Opposite. 3 = Unchanged – This allows other Cam parameters to be changed without altering the current or previous Camming direction. When executed for the first time with Unchanged selected, the control defaults the direction to Same. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cam Profile | CAM_PROFILE CAM_PROFILE_EXTENDED CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllersUse the Motion Redefine Position (MRP) instruction to change the command or actual position of an axis. The value specified by Position is used to update the Actual or Command position of Axis. The position redefinition can be calculated on an Absolute or Relative basis. If Absolute is selected the Position value is assigned to the current Actual or Command position. If Relative is selected the Position value is added as a displacement to the current Actual or Command position. The process of redefining the current axis position has no affect on motion in progress as the instruction preserves the current servo following error during the redefinition process. As a result, axis position can be redefined on-the-fly without disturbing axis motion. Available Languages Ladder Diagram Function Block This instruction is not available in function block. Structured Text MRP(Axis,MotionControl,Type,PositionSelect,Position); Operands Ladder Diagram and Structured Text
See Structured Text Syntax for more information on the syntax of expressions within structured text.For the operands that require you to select from available options, enter your selection as:
MOTION_INSTRUCTION Structure
Description The MRP instruction directly sets the actual or command position of the specified axis to the specified absolute or relative position. No motion is caused by this instruction—the current axis position is simply redefined. Select or enter the desired Axis, Type, Position Selection, and enter a value or tag variable for the desired New Position. If the targeted axis does not appear in the list of available axes, the axis has not been configured for operation. Use the Tag Editor to create and configure a new axis. The MRP instruction may be used while the axis is moving as well as when it is at rest. MRP is used to redefine position on-the-fly for certain registration, slip compensation, and re-calibration applications.
In this transitional instruction, the relay ladder, toggle the Rung-condition-in from cleared to set each time the instruction should execute. Master Driven Speed Control (MDSC) and the MRP Instruction You can execute an MRP on the Master or the Slave axes or coordinate system when an MDSC is active. The Master axis position is changed when an MRP is executed (goes IP) on the Master while it is moving in MDSC mode; the slave is not affected. Affects Math Status Flags No Major/Minor Faults None specific to this instruction. See Common Attributes for operand-related faults.Execution Ladder Diagram
Structured Text
Error Codes See Error Codes (ERR) for Motion Instructions. Extended Error Codes Extended Error Codes provide additional instruction specific information for the Error Codes that are generic to many instructions. See Motion Error Codes (.ERR) for Motion Instructions. The following Extended Error codes help to pinpoint the problem when the MRP instruction receives a Servo Message Failure (12) error message.
Extended Error codes for the Parameter Out of Range (13) error code work a little differently. Rather than having a standard enumeration, the number that appears for the Extended Error code refers to the number of the operand as they are listed in the faceplate from top to bottom with the first operand being counted as zero. Therefore for the MRP instruction, an extended error code of 4 would refer to the Position operand’s value. You would then have to check your value with the accepted range of values for the instruction. MRP Changes to Single Axis Status Bits The AxisHomedStatus bit is not impacted by the execution of the MRP instruction. The status is the same before and after the MRP is execution. If the axis has been homed using the absolute home procedure, the AbsoluteReferenceStatus is set. AxisHomedStatus may also be set is the axis has not been subject to a power cycle. AbsoluteReferenceStatus is cleared when the MRP is executed and this is only true to Axis_Servo_Drive axis. This indicates the axis position is no longer referenced to the absolute home position. Examples Example 1 Ladder Diagram Example 2 Ladder Diagram | CAM_PROFILE CAM_PROFILE_EXTENDED | Array | Tag name of the calculated cam profile array used to establish the master/slave position relationship. Only the zero array element ([0]) is allowed for the Cam Profile array. Ellipsis launches Cam Profile Editor. Use the CAM_PROFILE_EXTENDED type for this operand to enable access to double-precision (64-bit LREAL) cam data members. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Slave Scaling | REAL | REAL | Immediate or Tag | Scales the total distance covered by the slave axis through the cam profile. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Master Scaling | REAL | REAL | Immediate or Tag | Scales the total distance covered by the master axis through the cam profile. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Execution Mode | DINT | DINT | Immediate | Determines if the cam profile is executed only one time or repeatedly: 0 = Once – Once started the slave axis follows the Cam profile until the Cam boundary is crossed. On crossing of the Cam boundary, Cam motion on the Slave axis stops and the .PC bit is set. The Position Cam Status bit in Slave axis’ Motion Status word is reset. The Slave motion does not resume if the Master axis moves back into the Cam profile range. 1 = Continuous – Once started the cam profile is executed indefinitely. This feature is useful in rotary applications where it is necessary that the cam position run continuously in a rotary or reciprocating fashion. 2 = Persistent - When the Master axis moves beyond the defined range, cam motion on the Slave axis stops. Cam motion on the Slave resumes in the opposite direction when the Master axis reverses and moves back into the Cam Profile range. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Execution Schedule | DINT | DINT | Immediate | Selects the method used to execute the cam profile. 0 = Immediate – The slave axis is immediately locked to the master axis and the position camming process begins. 1 = Pending – Lets you blend a new position cam execution after an in process position cam is finished. When Pending is selected, these parameters are ignored: Master Axis, Master Lock Position, and Master Reference. 2 = Forward only – The cam profile starts when the master position crosses the Master Lock Position in the forward direction. 3 = Reverse only – The cam profile starts when the master position crosses the Master Lock Position in the reverse direction. 4 = Bidirectional – The cam profile starts when the master position crosses the Master Lock Position in either direction. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Master Lock Position | REAL | REAL | Immediate or Tag | When the Master Offset = 0.0, the Master Lock Position is the Master axis absolute position where the slave axis locks to the master axis. If the Master Offset is X, the Slave axis locks to the Master axis at the absolute master position value of Master Lock Position –X. For example: Assume a Master Lock Position = 50 and a Master Offset Move = 10. Also assume that the Master axis move (MAM) and Master offset move (MOM) start at the same time. Then the Slave will lock to the Master at an absolute Master axis position of 40. This in effect shifts the Cam profile 10 units to the left. If Pending is selected as the Execution Schedule value, then Master Lock Position is ignored. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cam Lock Position | REAL | REAL | Immediate or Tag | This determines the starting location in the cam profile. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cam Type | DINT | DINT | Immediate | 0 = New Cam - The user wants to start a new Cam. This is the default value and provides backward compatibility for pre-V34 Studio 5000 Logix Designer releases. 1 = Replace and Restart - The replacement Cam will replace the active Cam and start interpolating at a position indicated by the Cam Lock Position. 2 = Replace and Continue – The replacement Cam will replace the active cam and will start interpolating from an internally calculated index which is the point at which the active Cam was replaced. The Cam Lock Position is ignored. This operand is new with V34 Studio 5000 Logix Designer. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Master Reference | DINT | DINT | Immediate | Sets the master position reference to either Command position or Actual position. If Pending is selected for the Execution Schedule value, then Master Reference is ignored. 0 = Actual – slave axis motion is generated from the current position of the master axis as measured by its encoder or other feedback device. 1 = Command – Slave axis motion is generated from the desired or commanded position of the master axis. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Master Direction | DINT | DINT | Immediate | This determines the direction of the master axis that generates slave motion according to the cam profile. Options are: 0 = Bidirectional – slave axis can track the master axis in either direction. 1 = Forward only – Slave axis tracks the master axis in the forward direction of the master axis. 2 = Reverse only – Slave axis tracks the master axis in the opposite direction of the master axis. |
Structured Text
MAPC (SlaveAxis, MasterAxis, MotionControl,Direction, CamProfile, SlaveScaling, MasterScaling, ExecutionMode,
ExecutionSchedule, MasterLockPosition, CamLockPosition, CamType, MasterReference, MasterDirection);
The operands are the same as those for the relay ladder MAPC instruction. For the array operands, you do not have to include the array index. If you do not include the array index, the instruction starts with the first element in the array ([0]).
For the operands that require you to select from available options, enter your selection as:
This Operand | Has These Options Which You | |
---|---|---|
Enter as Text | Or Enter as a Number | |
ExecutionMode | Once Continuous Persistent | 0 1 2 |
ExecutionSchedule | Immediate Pending ForwardOnly ReverseOnly Bidirectional | 0 1 2 3 4 |
CamType | New Cam Replace and Restart Replace and Continue | 0 1 2 |
MasterReference | Actual Command | 0 1 |
MasterDirection | Bidirectional ForwardOnly ReverseOnly | 0 1 2 |
MOTION_INSTRUCTION Structure
Mnemonic | Description |
---|---|
.EN (Enable) Bit 31 | It is set when the rung makes a False-to-True transition and remains set until the rung goes False. |
.DN (Done) Bit 29 | It is set when the position cam is initiated. |
.ER (Error) Bit 28 | It is set to indicate that the instruction detected an error, such as if you specified an unconfigured axis. |
.IP (In Process) Bit 26 | It is set on positive rung transition and cleared if either superseded by another Motion Axis Position Cam command, or canceled by a stop command, merge, shut down, or servo fault. |
.AC (Active) Bit 23 | It is set when the cam begins interpolation of the Slave axis. It is reset when the Active cam execution is completed or cancelled by a stop command, merge, shut down, or servo fault. |
.PC (Process Complete) Bit 27 | It is cleared on positive rung transition and set in ONCE Execution Mode, when the position of the Master axis leaves the Master position range defined by the active Cam profile. |
TIP:
Version 34 and newer: The information in the MOTION_INSTRUCTION Structure Table pertaining to the .AC bit applies to the Compact GuardLogix (5380), CompactLogix (5380), CompactLogix (5480), ControlLogix (5580), GuardLogix (5580) and Logix Emulate series of controllers only. For other controllers, the .AC bit is shown on the instruction faceplate but is inactive and is always equal to False.
Description
The MAPC instruction executes a position cam profile set up by a previous Motion Calculate Cam Profile (MCCP) instruction or, alternatively, by the
Logix Designer
application Cam Profile Editor. Position cams, in effect, provide the capability of implementing non-linear electronic gearing relationships between two axes. No maximum velocity, acceleration, or deceleration limits are used. The motion of the Master Axis and designated Cam profile derived from the associated cam table determines the speed, acceleration, and deceleration of the Slave axis.
WARNING:
The maximum velocity, acceleration, or deceleration limits established during axis configuration do not apply to electronic camming.
The Direction input parameter determines the direction of Slave axis motion relative to the Master axis. The camming direction, as applied to the Slave, can be explicitly set as the Same or Opposite or set relative to the current camming direction as Reverse or Unchanged.
To accurately synchronize the Slave axis position to Master axis position, an Execution Schedule and an associated Master Lock Position setting can be specified for the Master axis. When the Master axis travels past the Master Lock Position in the direction specified by the Execution Schedule parameter, the Slave axis is locked to the Master axis position according to the specified Cam Profile beginning at the Master Lock Position.
The Cam Profile can also be configured to execute Immediately or Pending completion of a currently executing position cam profile via the Execution Schedule parameter.
The Cam Profile can be executed once, continuous, or in a persistent mode by specifying the desired Execution Mode.
The Master Reference selection allows camming input from the Master to be derived from either the Actual or Command position of the Master axis. A slip clutch feature is available to support applications that require unidirectional motion. It helps to prevent the Slave from backing up when the Master axis reverses direction. The Master Direction parameter controls this feature.
Master and Slave Scaling functionality can be used to scale Slave motion based on a standard cam profile without having to create a cam table and calculate a new cam profile.
The Cam Type selection allows the user to cancel a running cam and replace it with another cam immediately or schedule it to perform at a later position of the Master axis position.
Camming Direction
Cams can be configured to add or subtract their incremental contribution to the Slave axis command position. Control over this behavior is via the Direction parameter.
Camming in the Same Direction
When Same is selected or entered as the Direction for the MAPC instruction, the Slave axis position values computed from the cam profile are added to the command position of the Slave axis. This is the most common operation, as the profile position values are used as entered in the original cam table. Consecutive-increasing profile values result in axis motion in the positive direction and vice versa.
Camming in the Opposite Direction
When Opposite is selected or entered as the Direction, the Slave axis position values computed from the cam profile are subtracted from the command position of the slave axis. Thus, axis motion is in the opposite direction from that implied by the original cam table. Consecutive increasing profile values result in axis motion in the negative direction and vice versa.
Preserving the Current Camming Direction
When Unchanged is selected or entered as the Direction, other position cam parameters can be changed while preserving the current or previous camming direction (same or opposite). This is useful when the current direction is not known or not important. For first-time execution of a cam with Unchanged selected, the control defaults the direction to Same.
Reversing the Current Camming Direction
When Reverse is selected the current or previous direction of the position cam is changed from Same to Opposite or from Opposite to Same. For first-time execution of a cam with Reverse selected, the control defaults the direction to Opposite.
Specifying the Cam Profile
To execute a MAPC instruction, a calculated cam profile data array tag must be specified. The user can generate the Cam Profile array tags by using the
Logix Designer
application tag editor or the MAPC instruction by using the built-in Cam Profile Editor, or by executing a Motion Calculate Cam Profile (MCCP) instruction on an existing Cam array.The data within the Cam Profile array can be modified at compile time using the Cam Profile Editor, or at run-time with the Motion Calculate Cam Profile (MCCP) instruction. In the case of run-time changes, a Cam array must be created in order to use the MCCP instruction. Refer to the MCCP instruction specification for more detail on converting Cam arrays.
MAPC supports two types of Cam Profile array: CAM_PROFILE and CAM_PROFILE_EXTENDED. CAM_PROFILE is calculated from a CAM array. CAM_PROFILE_EXTENDED is calculated from a CAM_EXTENDED array, which provides better precision.
For CAM_PROFILE array, all but the status and type element of this Cam Profile array element structure are hidden from the
Logix Designer
application tag editor. These elements are of no value to the user. The Status member is used to indicate that the corresponding Cam Profile array element has been calculated. If execution of a camming instruction is attempted with any uncalculated elements in a cam profile, an error occurs. The type parameter determines the type of interpolation applied between this cam array element and the next cam element (for example, linear or cubic).For CAM_PROFILE_EXTENDED array, the status, master and slave values, type, and C0, C1, C2, C3 coefficients are visible in the
Logix Designer
tag editor. Use the status parameter to indicate that the CAM_PROFILE array element has been calculated. If a camming instruction begins to execute with uncalculated elements in a CAM_PROFILE, an error occurs. The master and slave define the x and y value of the cam element. The type parameter determines the type of interpolation applied between this cam array element and the next cam element (for example, linear or cubic). The C0, C1, C2, and C3 are coefficients that define the shape between two cam elements. They are calculated by the Motion Calculate Cam Profile (MCCP) instruction or Cam Profile Editor and should not be modified. Attempting to modify C0, C1, C2, and C3 coefficients could cause unintended motion.
WARNING:
Do not modify the Cam Profile array directly. Modifying the Cam Profile array can cause unintended motion or a motion fault.
Always use Motion Calculate Cam Profile (MCCP) or the Cam Profile editor to adjust the Cam Profile array.
Cam Profile Array Checks
The Status member of the first element in the cam profile array is special and used for data integrity checks. For this reason, the MAPC must always specify the cam profile with the starting index set to 0.
This first cam profile element Status member can have the following values.
Status Variables | Description |
---|---|
0 | Cam profile element has not been calculated. |
1 | Cam profile element is being calculated. |
2 | Cam profile element has been calculated |
n | Cam profile element has been calculated and is being used by ( n- 2) MAPC or MATC instructions. |
Before starting a cam on a specified axis, the MAPC instructions check if the Cam Profile array has been calculated by checking the value of the first Cam Profile element’s Status member. If the status is 0, 1 then the cam profile has not been calculated yet and the MAPC instruction error flag is set. If the Cam Profile array has been completely calculated (Status > 1), the instruction then increments the Status member indicating that it is in use by this axis.
When the cam completes, or ends, the Status member of the first Cam Profile array element is decremented to keep track of the number of cams that are using the associated cam profile.
Linear and Cubic Interpolation
Position cams are fully interpolated. This means that if the current Master axis position does not correspond exactly with a point in the cam table associated with the cam profile, the slave axis position is determined by linear or cubic interpolation between the adjacent points. In this way, the smoothest possible slave motion is provided.
Each point in the Cam array that was used to generate the Cam Profile can be configured for linear or cubic interpolation.
Electronic camming remains active through any subsequent execution of jog, or move processes for the Slave axis. This allows electronic camming motions to be superimposed with jog, or move profiles to create complex motion and synchronization.
Scaling Position Cams
A position cam profile can be scaled in both the master dimension and slave dimension when it is executed. This scaling feature is useful because it allows the stored cam profile to be used to determine the general form of the motion profile. The scaling parameters are then used to define the total master or slave travel over which the profile is executed, as shown in the illustration below. In this way, one standard cam profile can be used to generate a whole family of specific cam profiles.
When a cam profile array is specified by an MAPC instruction, the master and slave values defined by the cam profile array take on the position units of the master and slave axes respectively. By contrast, the Master and Slave Scaling parameters are unitless values that are used as multipliers to the cam profile.
By default, both the Master Scaling and Slave Scaling parameters are set to 1. To scale a position cam profile, enter a Master Scaling or Slave Scaling value other than 1.
Increasing the master scaling value of a cam profile decreases the velocities and accelerations of the profile, while increasing the slave scaling value increases the velocities and accelerations of the profile. To maintain the velocities and accelerations of the scaled profile approximately equal to those of the unscaled profile, the master scaling and slave scaling values should be equal. For example, if the slave scaling value of a profile is 2, the master scaling value should also be 2 to maintain approximately equal velocities and accelerations during execution of the scaled position cam.
WARNING:
Decreasing the Master Scaling value or increasing the Slave Scaling value of a position cam increases the required velocities and accelerations of the profile. This can cause a motion fault if the capabilities of the drive system are exceeded.
Execution Mode
Once
Execution Mode of Once, Continuous, or Persistent can be selected to determine how the cam motion behaves when the Master position moves beyond the start and end points of the profile defined by the original cam table.
When Once is selected (default), the specified cam profile, once started, executes until the Cam boundary is crossed. When the Master axis moves outside the range of the profile, cam motion on the Slave axis stops and the Process Complete (.PC) bit of the MAPC instruction is set. The Slave motion does not resume when and if the Master moves back into the profile range specified by the start and end points.
Continuous
When Continuous mode is selected, the specified cam profile, once started, is executed indefinitely. With continuous operation, the profile’s Master and Slave positions are unwound when the position of the Master axis moves outside the profile range, causing the cam profile to repeat. This feature is useful in rotary applications where it is necessary that the position cam run continuously in a rotary or reciprocating fashion. To generate smooth continuous motion by using this technique, however, care must be taken in designing the cam points of the cam table to confirm that there are no position, velocity, or acceleration discontinuities between the start and end points of the calculated cam profile.
Persistent
When Persistent mode is selected, the cam motion of the slave moves if the Master axis is within the cam profile range. When Master axis moves beyond the defined range, the cam motion on the Slave axis stops. When Master axis reverses and moves back into the cam Profile range, Slave axis resumes its cam motion as per cam profile.
Execution Schedule
The Execution Schedule parameter controls the execution of the MAPC instruction.
Immediate
By default, the execution schedule of MAPC instruction is Immediate. In Immediate execution, the Slave axis is immediately locked to the master axis and the position camming begins.
Active Cam
In the Immediate Active Cam case, there is no delay in execution of the position camming process. In this case, the Master Lock position parameter is irrelevant.
This figure illustrates Immediate Active Cam execution, with the camming process initiated on the Slave axis. Take notice of the Position Cam Status and Position Cam Lock Status of the Slave axis’ Motion status word is set to True. The Slave axis immediately locks to the master axis and follows the Cam profile.
Replace and Restart Cam
In the Immediate Replace and Restart Cam case, the Replacement Cam replaces the Active cam immediately at the programmed Cam Lock Position.
This figure illustrates Immediate Replace and Restart Cam execution. The Active cam initiates the camming process, and the Replacement cam is initiated with execution schedule of Immediate. The replacement happens at the programmed Cam Lock Position of zero, the Master Lock Position is ignored.
The Position Cam Status and Position Cam Lock Status bits of the Slave Axis’ Motion Status bits are set.
Replace and Continue Cam
In the Immediate Replace and Continue Cam case, the Replacement Cam replaces the Active cam immediately at the point at which the replacement was initiated. The Cam lock Position and Master Lock Position are ignored.
This figure illustrates Immediate Replace and Continue Cam execution. The Active cam initiates the camming process, and the Replacement cam is initiated with execution schedule of Immediate.
The Position Cam Status and Position Cam Lock Status bits of the Slave axis’ Motion Status bits are set.
Forward Only, Reverse Only, or Bidirectional
In the case where the Execution Schedule parameter of the instruction is set to Forward Only, Reverse Only, or Bidirectional, the Slave axis is not locked to the Master until the Master axis satisfies the corresponding condition.
Forward Only:
The replacement Cam replaces the Active Cam when the Cam reaches the replacement point while the Master moves in the forward direction.
Reverse Only:
Same as Forward Only except that the Master is moving in the reverse direction.
Bidirectional:
Same as Forward Only except that the Master is moving in either direction.
Replace and Continue Cam with Active Cam Unlocked:
The diagram illustrates when an Active Cam is initiated with Master Direction Forward Only, Execution Mode Immediate, and the Replacement Cam is executed later. The status transitions are indicated by the dotted vertical lines in the diagram.
- Active Cam Start: The Slave axis starts following the Master axis in the forward direction. The Position Cam Status and the Position Cam Lock Status of the Slave axis’ Motion status word bits are set to True.
- Master at Active Cam getting Unlocked: Due to the Master axis reversal, the Active cam is unlocked, and the Position Cam Lock Status of the Slave axis’ Motion status word bit is reset.
- Replacement Cam Start: While the Master Axis is moving in the reverse direction, the Replacement Cam is initiated with Active Cam still unlocked, and with the following configurations:
- Execution Schedule: Forward Only
- Master Direction: Forward Only
- Execution Mode: Persistent (PC bit does not turn to True after Cam Complete)
- Programmed Master Lock Position: 10 units
- Replacement at Master Lock Position: When the Master axis starts moving in forward direction and reaches Master Lock Position of 10 units, then the AC bit of the Replacement Cam Motion status word is set to True indicating that the Replacement Cam is ready to interpolate the Slave axis.
- Master at Active Cam getting Locked: When the Master axis is moving in forward direction and reaches the Master reversal point of the Active Cam, then the Active Cam is locked, and the Replacement Cam starts driving the Slave axis. Position Cam Lock Status of the Slave axis’ Motion status word bit is set to True. The Slave axis starts moving according to the Replacement Cam profile until the Master axis crosses the Cam boundary. The Position Cam Lock Status of the Slave axis’ Motion status word bit is reset.
- Replace and Restart Cam with Active Cam Locked: The diagram illustrates when an Active Cam is initiated with Master Direction Forward Only, Execution Mode Immediate, and the Replacement Cam is executed later, the status transitions are indicated by the dotted vertical lines in the figure.
- Active Cam Start: The Slave axis starts following the Master axis in the forward direction. The Position Cam Status, Position Cam Lock Status of the Slave axis’ Motion status word bits are set to True.
- Replacement Cam Start: While the Master axis is moving in forward direction, the Replacement Cam is initiated with Active Cam still Locked, and with the following configurations:
- Execution Schedule: Forward Only
- Master Direction: Forward Only
- Execution Mode: Persistent (PC bit does not turn to true after Cam Complete)
- Programmed Master Lock Position: 15 units
- Replacement at Master Lock Position: When the Master Axis starts moving in the forward direction and reaches Master Lock Position of 15 units, then the AC bit of the Replacement Cam status word is set to True indicating that the Replacement Cam is ready to interpolate the Slave Axis. The Replacement Cam starts moving according to the Replacement Cam profile until the Master Axis crosses the Cam boundary. The Position Cam Lock Status of the Slave Axis’ Motion status word bit is set to False then.
Pending Cam
Alternatively, the MAPC instruction’s execution can be deferred pending completion of a currently executing position cam. An Execution Schedule selection of Pending can thus be used to blend two position cam profiles without stopping motion.
The Pending execution feature is useful in applications like high-speed packaging when a Slave axis must be locked onto a moving Master axis and accelerate by using a specific profile to the proper velocity. When this acceleration profile is done, it must blend into the operating profile, which is typically executed continuously. To stop the Slave axis, the operating profile is smoothly blended into a deceleration profile such that the axis stops at a known location as shown in the figure.
To confirm smooth motion across the transition, however, the profiles must be designed such that no position, velocity, or acceleration discontinuities exist between the end of the current profile and the start of the new one. This is done by using the Studio 5000 Logix Designer application Cam Profile Editor.
If an Execution Schedule of Pending is selected without a corresponding Active Cam profile in-process, the MAPC instruction executes but no camming motion occurs until another MAPC instruction with a non-pending Execution Schedule is initiated. This allows pending Cam profiles to be preloaded before executing the initial cam. This method addresses cases where immediate Cams would finish before the pending Cam could be reliably loaded.
Replacement Cam effect on a Pending Cam
This figure shows an example of how Pending Cam status flags are affected when a Replacement Cam executes before a Pending Cams’ start. The dotted vertical lines in the figure indicates the status transitions. When the Replacement Cam executes, the Pending Cam’s .IP bit is set and the Replace and Restart Cam Profile runs.
(1) Active Cam starts.
(2) Pending Cam is enabled and waiting for the completion of the Active Cam. The Pending Cam’s. IP and .DN bits are set.
(3) Replacement Cam executes before the end of the Active Cam profile completes. The Pending Cam .IP bit resets.
(4) Cam Complete, replacement Cam’s .PC bit is set.
Master Lock Position
The programmed Master Lock Position of the replacement Cam is the replacement position (point).
In a Rotary Axis configuration, Master Lock Position is independent of the turns count. The user must confirm that the Master Lock position is within the profile range of the active Cam.
Master Reference
The Master Reference parameter determines the master position source to link to the cam generator. This source can be actual position or command position of the master axis. Smoother motion is derived from command position but in some cases, for example when a physical axis is not controlled by a
ControlLogix
motion module, actual position is the only practical option.Slaving to the Actual Position
When Actual Position is entered or selected as the Master Reference source, the Slave axis motion is generated from the actual position of the master axis as shown below.
Actual position is the current position of the Master axis as measured by its encoder or other feedback device. The only selection when the Master axis Type is configured as Feedback Only since it is often necessary to synchronize the actual positions of two axes.
Slaving to the Command Position
When Command Position is entered or selected as the Master Reference source, the Slave axis motion is generated from the command position of the Master axis as shown below.
Command position (only available when the Master axis’ Axis Type is a Servo or Virtual axis) is the desired or commanded position of the Master axis.
Since the command position does not incorporate any associated following error or external position disturbances, it is a more accurate and stable reference for camming. When camming to the command position of the master, the Master axis must be commanded to move to cause any motion on the Slave axis.
Master Direction
Normally, the Master Direction parameter is set to Bidirectional (default). However, when Forward Only is selected for Master Direction, the lave axis tracks the master axis in the forward direction of the Master axis. When Reverse Only is selected, the Slave axis tracks the Master axis in the reverse direction of the Master axis. If the Master axis changes direction, the Slave axis does not reverse direction, but stays where it was when the master reversed. This Uni-directional feature of position cams is used to provide an electronic slip clutch, which helps prevent the cam motion generator from moving backward through the cam profile if the master reverses direction.
When the Master axis again reverses, resuming motion in the desired direction, the Slave axis picks up again when the master reaches the position where it initially reversed. In this way, the Slave axis maintains synchronization with the master while motion in the wrong direction is inhibited. This is especially useful where motion in a certain direction can damage the machine or to the product.
Moving While Camming
Motion Axis Moves can be performed while camming to provide sophisticated phase and offset control while the Slave axis is running.
Incremental Moves
An Incremental Motion Axis Move (MAM) instruction can be used on the Slave axis (or Master axis if configured for Servo operation) while the position cam is operating. This is useful to accomplish phase advance/retard control. The incremental move distance can be used to eliminate any phase error between the master and the slave, or to create an exact phase relationship.
Master Offset Moves
A MAM instruction can also be used while the position cam is operating to shift the master reference position of the cam on the fly. Unlike an incremental move on the slave axis, a master offset move on the Slave axis shifts the cam profile relative to the Master axis, as shown in the figure below.
When the MAPC instruction (except pending) is initiated, the corresponding active Master Offset Move is disabled and the corresponding Master Offset, Strobe Offset, and Start Master Offset are reset to zero. In order to achieve the master reference position shift, the MAM instruction must be initiated after the MAPC is initiated.
See the Motion Axis Move (MAM) instruction for more information on Master Offset moves.
Cam Lock Position
The Cam Lock Position determines the starting location within the Cam Profile when the Slave locks to the Master. Typically, the Cam Lock Position is set to the beginning of the Cam profile. Since the starting point of most cam tables is zero, the Cam Lock Position is typically set to zero. Alternatively, the Cam Lock Position can be set to any position within the Master range of the Cam profile.
The figure illustrates a Cam profile with two different Cam Lock Positions. The red line indicates the Cam profile execution with a Cam Lock Position of zero, and the blue line indicates the same Cam profile execution with a Cam Lock Position of ten. Take notice of how the profile shifts from point 1 to point 1’, point 2 to point 2’, and so on.
In the figure, the Slave axis is at position of 30 units when the Master is at a position of ten units with a Cam Lock Position of zero as shown in red and indicated by 1. When the Cam Lock Position is changed from zero to ten units, the Slave axis profile is offset by 30 units at each row of the Slave axis position. Shown below is how each row’s Slave value is calculated.
[ ] | Master | Slave | Slave' |
---|---|---|---|
0 | 0 | 0 | 1' = S 1 - 30 1' = 30 - 30 = 0 |
1 | 10 | 30 | 2' = S 2 - 30 2' = 35 - 30 = 5 |
2 | 20 | 35 | 3' = S 3 - 30 3' = 30 - 30 = 0 |
3 | 30 | 30 | 4' = S 4 - 30 4' = 0 - 30 = 30 |
4 | 40 | 0 | Profile ended '4 = End of Cam Boundary |
Cam Type
The Cam Type parameter indicates that the programmed cam is a new or replacement cam. The selection allows the user to choose New Cam, Replace and Restart, and Replace and Continue.
New Cam
New Cam should be used when the user wants the programmed cam to be a new cam. This is the default value for the Cam Type parameter and provides backward compatibility for the
Studio 5000 Logix Designer
application. New Cam starts its cam profile at the beginning or when the Pending Cam starts after the Active Cam is complete. This figure illustrates the execution of a New Cam.
Replace and Restart
Use the enumeration Replace and Restart to replace the current running cam. Replacement Cam with Cam Type Replace and Restart starts the cam profile at the programmed Cam Lock Position. The replacement happens without any consideration of velocity, acceleration, jerk disturbances.
The user is responsible for minimizing any velocity, acceleration, and jerk disturbances through proper Cam design. This figure illustrates the execution of Replace and Restart.
Replace and Continue
Use the enumeration Replace and Continue to replace the Active Cam at any point when it is in progress. At the replacement point, the Replacement cam starts to interpolate the Slave axis. The figure illustrates the execution of a Replace and Continue.
The green dotted line indicates the positions of the Slave axis if the Replacement Cam started at the same time as Active Cam.
The blue dotted line indicates the Slave axis positions if the Active Cam continued execution beyond the replacement point.
The sudden change in Slave Position at the replacement point is due to the Replacement Cam profile now defining the new Slave axis positions.
Stopping a Cam
Like other motion generators (jog, move, gear) active cams must be stopped by the various stop instructions, such as the Motion Axis Stop (MAS) or the Motion Group Stop (MGS). Cam motion must also stop when the
ControlLogix
processor changes OS modes. The MAS instruction must be able to stop the camming process. This behavior should be identical to the MAS functionality that specifically stops a gearing process.Merging from a Cam
Like other motion generators (jog, move, gear) active cams must also be compliant with motion merge functionality. Moves and Jogs must be able to merge from active camming. This behavior should be identical to the merge functionality applied to a gearing process.
Fault Recovery
Sometimes it is necessary to respond to an axis fault condition without losing synchronization between a Master and Slave axis that are locked in a cam relationship. With an active cam, there are several ways to handle axis faults.
Create a virtual axis and cam everything to it and, if necessary, gear this virtual Master axis to actual Master axis of the machine. Set the various fault actions for all axes to Status Only. When an axis fault occurs (for example, a drive fault) an application program monitoring the axes fault status detects the fault and does a controlled stop of all active axes by stopping the virtual Master axis. At the profiler level, everything is still fully synchronized. Use the following error on faulted axis to determine how far it is out of position. Reset the fault on the faulted axis, bring into position at a controlled speed using the MAM instruction and the computed following error. Finally, start moving virtual Master axis.
Same configuration as above but, in this case, when the Slave axis faults the axis fault action disables the drive. This stops the active cam process on the Slave axis. At this point, the application program stops all other axes via the virtual Master axis. Next, reposition the faulted axis by determining where the Master is, and then calculating where the Slave axis should be had the fault not occurred. Finally, do an immediate lock MAPC to resynchronize with the Cam Lock Position set to the calculated value.
NOTE:
The MAPC instruction execution completes in a single scan, thus the Done (.DN) bit and the In Process (.IP) bit are set immediately. The In Process (.IP) bit remains set until the initiated PCAM process completes, is superseded by another MAPC instruction, ended by a Motion Axis Stop command, Merge operation, or Servo Fault Action. The Process Complete (.PC) bit is cleared immediately when the MAPC executes and sets when the cam process completes (.PC) when configured for Once Execution Mode.
This is a transitional instruction:
- In relay ladder, toggle EnableIn from False to True each time the instruction should execute.
- In structured text, condition the instruction so that it only executes on a transition. For more information, see Structured Text Syntax.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. A major fault can occur if an uninitialized reference or a reference of incorrect type is passed to the Axis operand. See Index through Arrays for array-indexing faults.
Execution Conditions
In Structured Text, EnableIn is always True during normal scan. Therefore, if the instruction is in the control path activated by the logic, it executes.
All conditions below the thick solid line can only occur during Normal Scan mode.
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | The .EN, .DN, .ER, .IP, .AC, and .PC bits are cleared to False. |
Postcan | No action taken. |
Enable is False | The .EN bit is cleared to False if either the .DN or .ER bit is True. |
EnableIn is True and .EN bit is False | The .EN bit is set to True and the instruction executes according to the latest version of the Motion Instruction PISD document. |
EnableIn is True and .EN bit is True | No action taken. |
Error Codes
See Error Codes (.ERR) for Motion instructions.
Extended Error Codes
Extended Error Codes provide additional instruction-specific information for the Error Codes that are generic to many instructions.
Extended Error Codes for Axis Not Configured (11) error code are as follows:
- Extended Error Code 1 signifies that the Slave axis is not configured.
- Extended Error Code 2 signifies that the Master axis is not configured.
Extended Error codes for the Parameter Out of Range (13) error code lists a number that refers to the number of the operand as they are listed in the faceplate from top to bottom with the first operand being counted as zero. Therefore for the MAPC instruction, an extended error code of 5 would refer to the Slave Scaling operand’s value. You would then have to check your value with the accepted range of values for the instruction.
For the Error Code 54 – Maximum Deceleration Value is Zero, Click the ellipsis button next to the offending axis to access the Axis Properties screen. Go to the Dynamics tab and make the appropriate change to the Maximum Deceleration Value. If the Extended Error number is -1, that means the Coordinate System has a Maximum Deceleration Value of 0. Go to the Coordinate System Properties Dynamics Tab to correct the Maximum Deceleration value.
.SEGMENT field
The .SEGMENT field for the ILLEGAL_CAM_TYPE (28), ILLEGAL_CAM_ORDER (29) or INVALID_CAM_PROFILE_ELEMENT (179) error codes indicate the Cam Profile array element that contains, respectively, an invalid Cam Profile type (not linear or cubic), a non-ascending Master position or an invalid value (such as overflow or not a number). Therefore, INVALID_CAM_PROFILE_ELEMENT with .SEGMENT field value of 3 indicates that the fourth element (or [3]) of the Cam Profile array contains the invalid number. Use the Motion Calculate Cam Profile (MCCP) instruction or Cam Profile editor to recalculate the Cam Profile and confirm that the master and slave values do not contain an invalid value.
Status Bits
Position Cam Status
This Status bit indicates that the Motion Axis Position Cam profile is in progress. It is set when the Motion Axis Position Cam command is initiated on the Slave axis.
It is reset when these conditions are met:
- The Active or Replacement Cam completes with Execution Mode Once.
- The Slave axis is stopped (MAS, MCS) with Stop Type All or Position Cam.
- The Slave axis is shut down (MASD, MGSD, MCSD).Execution ModeBit NameStatementOncePersistentContinuousPosition Cam StatusIt is set when the Motion Axis Position Cam command is initiated on the Slave axis.TRUETRUETRUEIt is reset when the Active or Replacement Cam completes execution.TRUEFALSEFALSE
Position Cam Lock Status
The Position Cam Lock Status bit indicates the status when the Master axis starts driving the Slave axis based on the Cam Profile and Slave Direction. It is set when the Master axis satisfies the conditions: Execution Mode, Execution Schedule, Master Direction, and Cam Lock Position.
It is reset when these conditions are met:
- The Master axis crosses the Cam boundary in Execution Mode Once and Persistent.
- The Master axis is moving in the reverse direction as specified in the Master direction.
- The Slave axis is stopped (MAS, MCS) with Stop Type All or Position Cam.
- The Slave axis is shut down (MASD, MGSD, MCSD).
Execution Mode | ||||
---|---|---|---|---|
Bit Name | Statement | Once | Persistent | Continuous |
Position Cam Lock Status | It is set when the Master axis starts driving the Slave axis. | TRUE | TRUE | TRUE |
It is reset when the Master axis crosses the Cam boundary. | TRUE | TRUE | FALSE |
Bit Name | Statement | Execution Schedule |
---|---|---|
Position Cam Lock Status | It is set Immediately. Master Lock and Cam Lock Position are ignored. | Immediate |
It is set when the Master axis satisfies the conditions: Execution Mode, Execution Schedule, Master Direction, and Cam Lock Position. | Forward Only
Reverse Only
Bidirectional |
The figure illustrates Replace and Restart Cam with Active Cam Unlocked. In the figure, an Active Cam is initiated with Execution Mode Persistent, and the Replacement cam is executed later with Active Cam unlocked condition. The dotted vertical lines indicate the status transitions.
(1) Active Cam Start
The Slave axis starts following the Master axis in the forward direction. The Position Cam Status and Position Cam Lock Status bits of the Slave axis’ Motion Status bit are set.
(2) Active Cam getting Unlocked
Due to the Master axis crossing the Active Cam profile boundary in forward direction, the Active cam is unlocked, and the Position Cam Lock Status of the Slave axis’ Motion status word bit is reset. The Position Cam Status of the Slave axis’ Motion Status bit is Unchanged and remains True.
(3) Replacement Cam Start
The Replacement Cam is initiated with Active Cam still unlocked, and with these configurations:
- Execution Schedule: Immediate
- Master Direction: Forward Only
- Execution Mode: Persistent (PC bit does not turn to True after Cam Complete)
The Position Cam Lock Status of the Slave axis’ Motion status word bit is set, and the Position Cam Status of the Slave axis’ Motion Status bit is Unchanged and remains True.
The Slave axis starts moving according to the Replacement Cam profile until the Master axis crosses the Cam boundary. The Position Cam Lock Status of the Slave axis’ Motion status word bit is reset, and the Position Cam Status of the Slave axis’ Motion Status bit is Unchanged and remains True.
Position Cam Pending Status
This Status bit indicates that the Motion Axis Position Cam profile is pending the completion of an executing cam profile.
It is set when these conditions are met:
- The Motion Axis Position Cam with Execution Schedule Pending initiates.
- Replacement Cam initiated with Execution Schedule of Forward Only, Reverse Only, or Bidirectional.
It is reset when these conditions are met:
- The current Position Cam profile completes, which starts the pending Cam profile.
- Replacement Cam satisfies the conditions of Execution Schedule and Master Lock Position.
- The Slave axis is stopped (MAS, MCS) with Stop Type All or Position Cam.
- The Slave axis is shut down (MASD, MGSD, MCSD).
Bit Name | Statement | Execution Schedule |
---|---|---|
Position Cam Pending Status | FALSE | Immediate |
TRUE | Pending | |
It is set until the Master Axis satisfies the condition based on Execution Mode, Execution Schedule, Master Direction, and Cam Lock Position | Replacement Cam with:
Forward Only
Reverse Only
Bidirectional |
The figure illustrates Replace and Restart Cam execution with Active Cam Locked. In the figure, an Active Cam is initiated with Execution Mode Persistent, and the Replacement cam is executed later with Active Cam locked condition. The status transitions are indicated by the dotted vertical lines.
(1) Active Cam Start
The Slave axis starts following the Master axis in the forward direction. The Position Cam Status and Position Cam Lock Status bits of the Slave axis’ Motion Status bit are set. The Position Cam Pending Status bit of the Slave axis’ Motion Status bit is reset.
(2) Replacement Cam Start
The Replacement Cam is initiated with the Active Cam still locked, and with these configurations:
- Execution Schedule: Forward Only
- Master Direction: Forward Only
- Execution Mode: Persistent (PC bit does not turn to True after cam Complete)
- Programmed Master Lock Position: 30 Units
The Position Cam Pending Status of the Slave axis’ Motion status word bit is set. The Position Cam Status and the Position Cam Lock Status of the Slave axis’ Motion Status bit are Unchanged and remains True.
(3) Active Cam getting Unlocked
Due to the Master axis crossing the Active Cam profile boundary in forward direction, the Active cam is unlocked, and the Position Cam Lock Status of the Slave axis’ Motion status word bit is reset. The Position Cam Status of the Slave axis’ Motion Status bit is Unchanged and remains True.
(4) Replacement at Master Lock Position
When the Master axis starts moving in forward direction and reaches Master Lock Position of 30 units, the Position Cam Lock Status of the Slave axis’ Motion status word bit is set, and the Position Cam Pending Status of the Slave axis’ Motion status word bit is reset. The Position Cam Status of the Slave axis’ Motion Status bit is Unchanged and remains True.
The Slave axis starts moving according to the Replacement Cam profile until the Master axis crosses the cam boundary. The Position Cam Lock Status of the Slave axis’ Motion status word bit is reset.
Example
Relay Ladder Logic
Structured Text
MAPC (Axis0, Axis1, MAPC_1, 1, Cam_prof1[0], 1.0, 1.0, Once, Immediate, Mlckpos, Clckpos, NewCam, Actual, ForwardOnly);
Provide Feedback