Motion Calculate Cam Profile (MCCP)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Motion Calculate Cam Profile (MCCP) Page 1 of 4

Motion Calculate Cam Profile (MCCP)

The Motion Calculate Cam Profile (MCCP) instruction calculates a cam profile based on an array of cam points. An array of cam points may be
established programmatically or by use of the RSLogix 5000 Cam Profile Editor. Each cam point in the cam array consists of a slave position value,
a master position (position cam) or time (time cam) value, and an interpolation type (linear or cubic). The resulting cam profile may be used by a
Motion Axis Position Cam (MAPC) instruction or Motion Axis Time Cam (MATC) instruction to govern the motion of a slave axis according to master
position or time.

Operands

Ladder Diagram

Operand Type Format Description

Motion Control MOTION_INSTRUCTION Tag Structure used to access block status parameters.
Cam CAM Array Tag name of the cam array used to compute the cam profile. The numerical array
index indicates the starting cam element in the array used in the cam profile
calculation. Ellipsis launches Cam Profile Editor.
Length UINT Immediate Determines the number of cam elements in the array used in the cam profile
or Tag calculation.
State Slope REAL Immediate This is the boundary condition for the initial slope of the profile. It is valid only for
or Tag a cubic first segment and is used to specify a slope through the first point.
End Slope REAL Immediate This is the boundary condition for the ending slope of the profile. It is valid only
or Tag for a cubic last segment and is used to specify a slope through the last point.
Cam Profile CAM_PROFILE Array Tag name of the calculated cam profile array used as input to MAPC and MATC
instructions. Only the zero array element ([0]) is allowed for the Cam Profile
array. Ellipsis launches Cam Profile Editor.

Structured Text

MCCP(Motion Control, Cam, Length, Start Slope, End Slope, Cam Profile);
The operands are the same as those for the relay ladder MCCP instruction. For the array operands, you do not have to include the array index. If
you do not include the index, the instruction starts with the first element in the array ([0]).

MOTION_INSTRUCTION Structure

Mnemonic Description

.EN (Enable) Bit 31 The enable bit is set when the rung transitions from false-to-true
and stays set until the done bit is set and the rung goes false.
.DN (Done) Bit 29 The done bit is set when the calculate cam instruction has been
successfully executed and the Cam Profile array calculated.
.ER (Error) Bit 28 The error bit indicates when the instruction detects an error, such
as if the cam array is of an illegal length.

Description

The MCCP instruction computes a cam profile based on a given set of points in a specified cam array. The resultant cam profiles generated by this
instruction may be used by subsequent Motion Axis Position Cam (MAPC) or Motion Axis Time Cam (MATC) camming instructions to provide
complex motion of a slave axis with respect to either a master axis position or with respect to time.
Since cam profiles can be directly calculated by the RSLogix 5000 Cam Profile Editor, the main purpose of the MCCP instruction is to provide a
method for calculating cam profiles in real-time based on programmatic changes to the corresponding cam arrays.
The MCCP instruction computes a cam profile based on a given set of points in a specified cam array. The resultant cam profiles generated by this
instruction may be used by subsequent Motion Axis Position Cam (MAPC) or Motion Axis Time Cam (MATC) camming instructions to provide
complex motion of a slave axis with respect to either a master axis position or with respect to time.
Since cam profiles can be directly calculated by the RSLogix 5000 Cam Profile Editor, the main purpose of the MCCP instruction is to provide a
method for calculating cam profiles in real-time based on programmatic changes to the corresponding cam arrays.
Specifying a Cam Array
In order to execute an MCCP instruction, a Cam array tag must be created using the RSLogix Tag Editor or the Cam Profile Editor. The figure
below illustrates how the Cam array tags are established and used as input to the MCCP instruction.

mk:@MSITStore:C:\Program%20Files%20(x86)\Rockwell%20Software\RSLogix%2050... 02/07/2017
Motion Calculate Cam Profile (MCCP) Page 2 of 4

The Cam array elements consist of slave (yp) and master (xp) point pairs as well as an interpolation type. Since there is no association with a
specific axis position or time, the x and y point values are unitless. The interpolation type may be specified for each point as either linear or cubic.
Specifying the Cam Profile Tag
To execute a MAPC instruction, a Cam Profile array tag must also be created. Cam Profile array tags may be created by the RSLogix 5000 tag
editor or the MAPC/MATC instructions using the built-in Cam Profile Editor.
The data within the Cam Profile array can be modified at compile time using the Cam Profile Editor, or at run-time with the MCCP instruction. In
the case of run-time changes, a Cam array must be created in order to use the MCCP instruction.
The status parameter is used to indicate that the Cam Profile array element has been calculated. If execution of a camming instruction is
attempted using any uncalculated elements in a cam profile, the MAPC or MATC instructions error. The type parameter determines the type of
interpolation applied between this cam array element and the next cam element.
Cam Profile Array Status Member
The Status member of the first element in the cam profile array is special and used for data integrity checks. For this reason, the MCCP 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 Description
Variables
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 currently being used by (n-2) or
MATC instructions.

Linear and Cubic Spline Interpolation


The resultant calculated cam profiles are fully interpolated. This means that if the current master position or time does not correspond exactly
with a point in the cam array used to generate the cam profile, the slave axis position is determined by linear or cubic interpolation between
adjacent points. In this way, the smoothest possible slave motion is provided. The MCCP instruction accomplishes this by calculating coefficients
to a polynomial equation that determines slave position as a function of master position or time.
Calculating the Cam Profile
Before calculating a cam profile on a specified axis, the MCCP instructions first checks if the cam profile array has been calculated by checking the
value of the first cam profile element’s Status member. If the Status value is either 0 or 2, the MCCP proceeds with the calculation of the cam
profile. When the cam profile array has been completely calculated, the MCCP instruction sets the first cam profile element’s Status value to being
calculated, or 1, and then sets the Status value of all other cam profile elements to being calculated. As the calculation proceeds, individual cam
profile members’ Status values are set to calculated, or 2. When all elements in the cam profile array have been calculated, the first cam profile
element’s Status value is also set to calculated.
However, if an MCCP instruction is executed with an initial cam profile Status value of 1, then the cam profile is currently being calculated by
another MCCP instruction, and the MCCP instruction errors. If the Status value is >2, then the cam profile is being actively used by an MAPC or
MATC instruction process, and the MCCP instruction errs.
Start Slope and End Slope
To facilitate a smooth entry into and exit from a cubic cam profile, slope control is provided. The Start Slope and End Slope parameters determine
the initial rate of change of the slave relative to the master. These values are used in the cubic spline calculations performed on the cam array.
The diagram below the master slave slope relationship.

The default values for Start Slope and End Slope are 0 to facilitate a smooth start and end to the cam profile from rest. However, if the axis is
already camming, an appropriate non-zero Start Slope can be specified to match the End Slope of the currently executing cam, to seamlessly
blend the two cam profiles together.
The Start Slope and End Slope values are not applicable when starting or ending the cam profile with linear interpolation.
Important: The MCCP instruction execution completes in a single scan. This instructions should therefore be placed in a separate task to avoid
impacting user program scan time.

This is a transitional instruction:

In relay ladder, toggle the rung-condition-in from cleared to set 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.

mk:@MSITStore:C:\Program%20Files%20(x86)\Rockwell%20Software\RSLogix%2050... 02/07/2017
Motion Calculate Cam Profile (MCCP) Page 3 of 4

Arithmetic Status Flags

Not affected

Fault Conditions

None

Error Codes

See Motion Error Code.


Extended Error Codes
Extended Error Codes provide additional instruction specific information for the Error Codes that are not specific enough to help pinpoint the
problem. When the MCCP instruction receives an Illegal Cam Length (26) error message to let it know that the length input parameter does not
correspond to what the instruction expects, the corresponding Extended Error code provides the number of cams in the Cam Tag provided to the
instruction. When the MCCP instruction receives an Illegal Cam Profile Length (27) error message to let it know that the length input parameter
does not correspond to what the instruction expects, the corresponding Extended Error code provides the number of cam points the instruction is
attempting to generate.

MCCP Changes to Status Bits

None.

Example

When the input instructions are true, the controller changes the speed, acceleration, or deceleration rate of a move profile or jog profile in progress
for axis_1.

Relay Ladder

Structured Text
MCCP(MCCP_1,Cam_1[0],30,1.0,1.0,cam_pro1[1]);

Related Instructions
Motion Axis Position Cam (MAPC)
Motion Axis Time Cam (MATC)

Related Topics
Structured Text Syntax
Motion Error Codes (.ERR)

mk:@MSITStore:C:\Program%20Files%20(x86)\Rockwell%20Software\RSLogix%2050... 02/07/2017
Motion Calculate Cam Profile (MCCP) Page 4 of 4

Extended Error Codes


Motion Move Instructions

mk:@MSITStore:C:\Program%20Files%20(x86)\Rockwell%20Software\RSLogix%2050... 02/07/2017

You might also like