MLProfileBuild

PLCopen motion icon Pipe Network motion icon

 Function - Creates a CAM Profile from application data that can be executed by a CAM block in Pipe Network or PLCopen.

Inputs

Input

Data Type

Range

Unit

Default

Description

Enable

BOOL

FALSE, TRUE

N/A

No default

Enables execution.

Starts on the rising edge.

Cam_Props

CamProps_ref

No range

N/A

No default

Structures containing the CAM Profile properties.

Cam_Data

CamData_ref

N=3 to 20,000 elements

N/A

No default

Array of structures containing the CAM Profile data.

CamDataCount

UINT

3 - 20,000

Elements

No default

Number of elements in the Cam_Data array to be used.

ProfileID

DINT

-2147483648 to 2147483647

N/A

No default

ID number of an initialized CAM Profile.

Cyclic

BOOL

FALSE, TRUE

N/A

No default

  • FALSE: One time through the profile.
  • TRUE: Repeating profile.

Options

INT

  • CAM_PROFILE_OPTION_DEFAULT: Allows the use of point and line segments.
  • CAM_PROFILE_OPTION_PARABOLIC: Allows the use of line and parabolic segments.

  • The DEFAULT and PARABOLIC options cannot be combined.
    A CAM Profile can only use point and line segments, or parabolic and line segments.
    Point and parabolic segments cannot both be used in the same profile.

N/A

No default

Describes the combinations of segments that can be used to build a cam profile.

Outputs

Output

Data Type

Range

Unit

Description

Done

BOOL

FALSE, TRUE

N/A

Indication of whether or not the profile was successfully compiled and built.

Busy

BOOL

FALSE, TRUE

N/A

Indication that the function block is executing.

  • TRUE if executing.
  • FALSE if not executing.

Err

BOOL

FALSE, TRUE

N/A

Indication that the function did not execute correctly.

ErrorID output is valid and indicate the reason.

ErrorID

INT

No range

N/A

Indicates the reason for the failure.

See the Error Codes table.

ErrorElem

UINT

No range

N/A

The array element number of the CAM data where an error is detected.

Remarks

  • This function block takes input as CAM data and CAM Profile properties from application data memory and compile the input data to a form the controller can use to calculate cam positions.
  • The input CAM data and CAM Profile properties are similar to the CAM data entered in the IDE’s CAM Editor and the runtime’s CAM Profile Properties dialog.

MLProfileBuild internally performs these functions:

  1. Compile the CAM data (like the cam editor performs in the IDE).
  2. Puts the compiled profile into the profile object so it can be used by other Profile Function Blocks.
    Provides similar functionality to MLProfileInit.

  • Prior to using MLProfileBuild, you must call MLProfileCreate to create the profile object.
    The ID output of MLProfileCreate is used as the ProfileID input to MLProfileBuild.
    MLProfileCreate must be performed in the application before the MLMotionStart command is executed.

  • MLProfileBuild compiles the CAM Profile data specified at the CamData input and writes the resulting profile to the CAM Profile object specified at input ProfileID.
  • The created profile can be used as an input to PLCopen CAM Function Blocks (e.g., MC_CamTblSelect, MC_CamIn, MC_CamOut), or any Pipe Network CAM Profile Function/Function Blocks.
  • When the operation is complete, the Done output is high.
    • If an error is encountered, the Error output is high and the ErrorID output returns an error code.
    • If the Error can be attributed to a specific profile element in the CamData array, ErrorElem attempts to indicate the element in error.

CamProps_Ref Structure

See Master/Input offset about the parameters which transform the CAM Profile.

CamData_Ref Structure

The Cam_Data function block input is an array of CamData_Ref structures.

Error Codes


  • If Cyclic is TRUE and the Vel/Accel of the first and last elements do not match, MLProfileBuild automatically copies the first element's Vel/Accel to the last element's.
    A log warning message is posted indicating that this change has occurred.

Example: Use MLProfileBuild

This example has these procedure steps:

Example: Building a Parabolic Cam Profile

To build a parabolic CAM Profile, your CAM data elements must use CAM_SEGMENT_TYPE_PARABOLIC or CAM_SEGMENT_TYPE_LINE when defining the cam data array.

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

            // Build the profile
Inst_MLProfileBuild( TRUE, ProfileProps, ProfileData, 3, ProfileID, TRUE, CAM_PROFILE_OPTION_DEFAULT);

See Also