Mitsubishi Electric MELSEC-Q-MR-JE-C Reference Manual

PLCopen Motion Control Function Block Reference
-MR-JE-C

CONTENTS

CHAPTER 1 OVERVIEW 3
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
1.3 System Configuration Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
1.4 Relevant Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Notes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
CHAPTER 2 FUNCTION DESCRIPTION 6
2.1 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
2.2 Program Details (Sample/PrgAxis1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 FB Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Data communication method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CC-Link IE Field Network Basic setting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
2.4 How to Use FB Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
Saving the user library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Installing the user library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17
CHAPTER 3 FB LIBRARY 19
3.1 Function Overview of the FB Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
List of FBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
Restrictions and precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
FB status diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21
Link device. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
3.2 Details of the FB Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
MC_Power (Operation Possible). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
MCv_Home (Home Position Return). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25
MC_Stop (Forced Stop). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
MC_Halt (Stop) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
MC_MoveAbsolute (Absolute Value Positioning) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
MC_MoveRelative (Relative Value Positioning) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
MC_MoveAdditive (Commanded Position Change) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
MC_MoveVelocity (Velocity Control) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
MC_TorqueControl (Torque Control). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41
MC_ReadActualPosition (Current Position Read). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
MC_ReadActualVelocity (Current Velocity Read) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46
MC_ReadActualTorque (Current Torque Read) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
MC_ReadStatus (Status Read) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
MC_ReadAxisInfo (Axis Information Read). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
MC_ReadAxisError (Axis Error Read). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
MC_Reset (Axis Error Reset) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.3 List of Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59
AXIS_REF_JEC (Axis information) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59
3.4 List of Global Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
MC_DIRECTION (Direction Selection) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60
3.5 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
List of error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CONTENTS
1
INSTRUCTION INDEX 63
REVISIONS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
TRADEMARKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66
2
1 OVERVIEW
1.1 Introduction
This function block (FB) library is used in a system in which the CC-Link IE Field Network Basic compatible MELSEC-Q series QnUDVCPU module and the MR-JE-C servo amplifier are connected. The FBs included in this library operate in the environment in which the profile mode is set as the co ntrol mode of the servo amplifier MR-JE-C. For the profile mode setting, refer to the instruction manual of the servo amplifier in use.

1.2 Applicable Hardware and Software

Applicable hardware and software Description
CPU module MELSEC-Q series CPU module Q**UDVCPU (First five digits of the serial No. are "18112" or later)
* Q06UDVCPU or later is recommended. Slave unit CC-Link IE Field Network Basic compatible MELSERVO-JE servo amplifier MR-JE-C Engineering software MELSOFT GX Works2 of version 1.560J or later

1.3 System Configuration Example

1

1.4 Relevant Manuals

• MR-JE-_C SERVO AMPLIFIER INSTRUCTION MANUAL [SH030257]
• MR-JE-_C SERVO AMPLIFIER INSTRUCTION MANUAL (CC-Link IE Field Network Basic) [SH030256]
• MR-JE-_C SERVO AMPLIFIER INSTRUCTION MANUAL (PROFILE MODE) [SH030254]
• MELSERVO-JE Servo amplifier INSTRUCTION MANUAL (TROUBLE SHOOTING) [SH030166]
• QCPU User's Manual (Hardware Design, Maintenance and Inspection) [SH080483]
• QnUCPU User's Manual (Function Explanation, Program Fundamentals) [SH080807]
• GX Works2 Version1 Operating Manual (Common) [SH080779]

1.1 Introduction

1 OVERVIEW

3
1.5 Notes
This manual describes functions of the function blocks. This manual does not include the information on restrictions for using CPU modules and the combination. Please read the user's manuals of the products before using them. Please note the followings and use the FBs described in this manual.
• When using the FBs in an actual system, confirm that the FBs do not cause system control problems.
• Consider the points where interlock conditions are required in the system and insert interlock conditio ns.
• Mitsubishi Electric Corporation will not compensate any damages caused by the FBs.
• Contents may be deleted or changed without prior notice.
4
1 OVERVIEW

1.5 Notes

MEMO
1
1 OVERVIEW
1.5 Notes
5
2 FUNCTION DESCRIPTION
2.1 Program
This FB library includes the sample programs which can be used in the configuration described in " P a g e 3 System Configuration Example". Each FB operation can be checked with the sample programs.
Program configuration
File name Description Model Engineering environment
MotionControl_JEC_FBs_Q.gxw FBD, ST program QnUDVCPU MELSOFT GX Works2
List of programs
Program name Description Execution type Description method
Sample/PrgAxis1 Each FB execution program axis 1 Scan FBD Sample/PrgAxis2 Each FB execution program axis 2 Scan FBD
FB/FUN
FB name Description Execution type Description method
CCIEFBasicStart Start of cyclic communication of the
specified axis
Scan FBD
Structure
Program name Description
stRemoteRegBasic Device definition of the refresh setting used in the FB library
Global label
Label name Description
G_stLinkBasic Refresh data information used in the FB library Axis1 Axis 1 information Axis2 Axis 2 information
Servo amplifier MR-JE-C parameter
Set the following parameters to the servo amplifier in advance. This sample program is designed not to use the input signals of the servo amplifier. Configure the settings according to safety measures required for system operation.
Parameter Setting detail Axis 1 Axis 2
PA01: Operation mode Profile mode 1009 1009 PD01: I/O signal automatic on
selection 1
Forced stop (automatic on) Forward rotation stroke end (automatic on) Reverse rotation stroke end (automatic on)
1C00 1C00
6

2 FUNCTION DESCRIPTION

2.1 Program

2.2 Program Details (Sample/PrgAxis1)
1. Configure the initial setting for using the FB library.
When the CPU module is switched from STOP to RUN, the axis information (Axis1) is set.
2. Start the cyclic communication of the servo amplifier.
When the CPU module is switched from STOP to RUN, the communication with the specified axis is started.
2
3. Set the servo amplifier in the servo ON status.
When the PowerOn label is turned ON, the specified axis is set in the servo ON status.
4. Execute the home position return.
When the Homing label is turned ON, the home position return is executed.
2 FUNCTION DESCRIPTION

2.2 Program Details (Sample/PrgAxis1)

7
5. Control the velocity and torque.
When the ExecSpeed label is turned ON, the velocity is controlled. When the ExecTorque label is turned ON, the torque is controlled.
6. Stop or forcibly stop the axis.
When the ExecHalt label is turned ON, the specified axis is stopped. When the ExecStop label is turned ON, the specified axis is forcibly stopped.
7. Read the axis error code and reset the error.
When the ReadError label is turned ON, the alarm of the servo amplifiers is read. When the ExecReset label is turned ON, the error is reset. Reset the error after the error cause is eliminated.
8
2 FUNCTION DESCRIPTION
2.2 Program Details (Sample/PrgAxis1)
8. Perform the position control.
When the ExecAbs label is turned ON, the absolute value positioning is performed. When the ExecInc label is turned ON, the relative value positioning is performed. When the ExecAdd label is turned ON, the commanded position is changed.
2
9. Monitor the current position, velocity, and torque.
When the Monitor label is turned ON, monitoring the current position, velocity, and torque is started.
2 FUNCTION DESCRIPTION
2.2 Program Details (Sample/PrgAxis1)
9
10.Monitor the axis information and status.
When the Monitor label is turned ON, monitoring the axis information and status is started.
10
2 FUNCTION DESCRIPTION
2.2 Program Details (Sample/PrgAxis1)
2.3 FB Operation
FB reads the data after the global labels
related to RX and RWr are set.
Write area
QCPU MR-JE-C
Read area
Write area
Device
Link
refresh
FB
MR-JE-C
Device
Write
FB
QCPU
Read area
Read area
Write area
Link
refresh
FB writes the data after the global labels
related to RY and RWw are set.
Read

Data communication method

To control the devices connected with CC-Link IE Field Network Basic, the control information is transmitted to and received from the connected devices though the RX/RY/RWr/RWw register. The FBs described in this manual execute reference and updating of the device specified in the link refresh setting. Defining the contents that the customer sets in the link refresh setting to the global label enables the FBs to access the device specified in the link refresh setting. The data is exchanged between the QCPU and the MR-JE-C in the fixed cycle by using the set device.
2
2 FUNCTION DESCRIPTION

2.3 FB Operation

11

CC-Link IE Field Network Basic setting

This section describes the setting method of the system in which the CC-Link IE Field Network Basic compatible CPU module (QnUDVCPU) and the MR-JE-C servo amplifier are connected.
1. Set the IP address of the CPU module (QnUDVCPU).
[Navigation] window [Parameter] [PLC Parameter]
Select the "Built-in Ethernet Port Setting" tab on the "Q Parameter Setting" window, and set the IP address.
12
2 FUNCTION DESCRIPTION
2.3 FB Operation
2. Configure the settin gs of CC-Link IE Field Network Basic.
[Navigation] window [Parameter] [PLC Parameter]
Select "CC-Link IEF Basic Setting" in the "Built-in Ethernet Port Setting" tab on the "Q Parameter Setting" window.
• Select "Use the CC-Link IEF Basic" on the "CC-Link IEF Basic Setting" window.
• Configure the network setting. Select "Network Configuration Setting" on the "CC-Link IEF Basic Setting" window. Add the MR-JE-C.
2
• Configure the refresh setting. In the following example, RX and RY are assigned to the device B, and RWw and RWr are assigned to the device W.
2 FUNCTION DESCRIPTION
2.3 FB Operation
13
3. Set the global label.
1) 2) 4)3)
Set the information specified in the refresh setting to the global label.
• Structure definition Define the devices specified in the refresh setting in the structure. The number of array elements of each label data type is equal to the number of "Points" of each devices set in the refresh setting. Structure na me : stR e mo te R egB a si c
Label name Data type Remark
bnRX Bit (0..n) n is "Number of RX device points - 1". In the example of Step 2, n i s " 127". bnRY Bit (0..n) n is "Number of RY device points - 1". In the example of Step 2, n is "127". unRWr Word [unsigned] (0..n) n is "Number of RWr device points - 1". In the example of Step 2, n is "63". unRWw Word [unsigned] (0..n) n is "Number of RWw device point s - 1". In the example of Step 2, n is "63".
• Global label definition Define the global label by using the structure set above. This library operates by using the data refreshed in the global label "G_stLinkBasic". Correctly assign the device used for data refresh. Otherwise, the FBs do not properly operate.
1) Select "VAR_GLOBAL" in "Class".
2) Set "G_stLinkBasic" in "Label Name".
3) Select the structure "stRemoteRegBasic" in "Data Type".
4) Assign the device according to the refresh setting.
14
2 FUNCTION DESCRIPTION
2.3 FB Operation
2.4 How to Use FB Library
To use the FB library of the sample project in other programs, output the FB library and import it to other project. The following shows the procedure.

Saving the user library

1. Open the project (MotionControl_JEC_FBs_Q.gxw).
Select "User Library" in "Navigation".
2
2. Select the library (MotionControl_JEC_V100A). Right-click the library and select "Open" from the menu.
2 FUNCTION DESCRIPTION

2.4 How to Use FB Library

15
3. After the library became editable, right-click the library and select "Save as" from the menu.
4. Enter the library file name and click the [Save] button.
In the following example, the library is named "MotionControl_JEC".
After the library has been saved, the following dialog box appears.
16
2 FUNCTION DESCRIPTION
2.4 How to Use FB Library

Installing the user library

1. Create a new project with the following setting.
Type: the model when the library is saved, Project Type: Structured Project, Language: Structured Ladder/FBD
2. Select "User Library" in "Navigation", and select "Install" from the library menu.
2
Select the saved library in the following dialog.
2 FUNCTION DESCRIPTION
2.4 How to Use FB Library
17
When the library has been installed normally, the following message appears and the library appears on the tree.
3. Expand the "FB/FUN" tree under "User Library", and add an FB to the program by dragging and dropping it.
Add the I/O label definition. If necessary, add the conditions such as the interlock or others.
18
2 FUNCTION DESCRIPTION
2.4 How to Use FB Library
3 FB LIBRARY
3.1 Function Overview of the FB Library

List of FBs

The following table lists the FBs used in the MELSEC-Q series QnUDVCPU module.
This library controls up to 16 stations of the servo amplifier MR-JE-C. The MR-JE-C uses the default mapping of the cyclic communication in the profile mode. For details, refer to the instruction manual of the servo amplifier in use.
MotionControl_JEC
Item Description Version
MC_Power_JEC Operation possible 00A MCv_Home_JEC Home position return 00A MC_Stop_JEC Forced stop 00A MC_Halt_JEC Stop 00A MC_MoveAbsolute_JEC Absolute value positioning 00A MC_MoveRelative_JEC Relative value positioning 00A MC_MoveAdditive_JEC Commanded position change 00A MC_MoveVelocity_JEC Velocity control 00A MC_TorqueControl_JEC Torque control 00A MC_ReadActualPosition_JEC Current position read 00A MC_ReadActualVelocity_JEC Current velocity read 00A MC_ReadActualTorque_JEC Current torque read 00A MC_ReadStatus_JEC Status read 00A MC_ReadAxisInfo_JEC Axis information read 00A MC_ReadAxisError_JEC Axis error read 00A MC_Reset_JEC Axis error reset 00A
3

Restrictions and precautions

Item Description
Restrictions and precautions
The following describes restrictions and precautions common to all FBs. The restrictions and precautions specific to each FB are separately described. Refer to Page 23 Details of the FB Library.
• The FB does not include error recovery processing. Program the error recovery processing separately in accordance with the required system operation.
• The FB does not detect an alarm or a warning that has occurred in the servo amplifier . Program the pro cessing to monitor alarms and warnings in the servo amplifiers. For the alarms and warnings that have occurred in the servo amplifiers, refer to the instruction manual of the servo amplifiers in use.
• The FB cannot be used in an interrupt program.
• Please ensure that an execution command (Execute or Enable) can be turned OFF with a program. Do not use this FB in programs that are only executed once, such as a subroutine program and FOR-NEXT loop because an execution command (Execute or Enable) cannot be turned OFF in these programs.
• The number of FB steps in a program varies depending on the CPU model to be used and I/O definitions.
• A duplicated coil warning may occur during compilation. However, the warning does not generate any problems.
• Set a circuit for each input label in an FB.
• When two or more FBs are used, be careful not to repeatedly specify and simultaneously start an axis.
• When an execution command (Execute or Enable) is turned ON, the FB reads data of the input label. Thus, set the input label before turning ON an execution command (Execute or Enable).
• Do not change the values of other input labels af ter tur ning ON an execution co mmand (Execute or Enab le). For some FBs such as the one whose operation type is real-time execution, however, input labels can be changed even after an execution command (Execute or Enable) is turned ON. For details, refer to Page 23 Details of th e FB Li brary.
• The FBs controls 16 slave stations. Set a station number of the servo amplifier within the setting range.
• The FBs control the servo amplifier MR-JE-C in the profile mode of the control mode. Set the parameter (PA01) of the servo amplifier to the profile mode. Use the default mapping for the cyclic communication.

3 FB LIBRARY

3.1 Function Overview of the FB Library

19
Loading...
+ 49 hidden pages