Servo Press Library UsersMan en 201611 W573-E1-02
Servo Press Library UsersMan en 201611 W573-E1-02
Servo Press Library UsersMan en 201611 W573-E1-02
User’s Manual
for Servo Press Library
SYSMAC-XR013
W573-E1-02
NOTE
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior
written permission of OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because
OMRON is constantly striving to improve its high-quality products, the information contained in this manual is
subject to change without notice. Every precaution has been taken in the preparation of this manual. Neverthe-
less, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages
resulting from the use of the information contained in this publication.
Trademarks
• Sysmac and SYSMAC are trademarks or registered trademarks of OMRON Corporation in Japan and other
countries for OMRON factory automation products.
• Microsoft, Windows, Windows Vista, Excel, and Visual Basic are either registered trademarks or trademarks of
Microsoft Corporation in the United States and other countries.
• EtherCAT® is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
• ODVA, CIP, CompoNet, DeviceNet, and EtherNet/IP are trademarks of ODVA.
Other company names and product names in this document are the trademarks or registered trademarks of their
respective companies.
Copyrights
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Introduction
Introduction
Thank you for purchasing an NJ/NX-series CPU Unit or an NY-series Industrial PC.
This manual contains information that is necessary to use the function blocks in the Servo Press
Library. (“Function block” is sometimes abbreviated as “FB”.) Please read this manual and make sure
you understand the functionality and performance of the NJ/NX-series CPU Unit before you attempt to
use it in a control system.
This manual provides function block specifications. It does not describe application restrictions or com-
bination restrictions for Controllers, Units, and components.
Refer to the user’s manuals for all of the products in the application before you use any of the products.
Keep this manual in a safe place where it will be available for reference during operation.
Intended Audience
This manual is intended for the following personnel, who must also have knowledge of electrical sys-
tems(an electrical engineer or the equivalent).
• Personnel in charge of introducing FA systems.
• Personnel in charge of designing FA systems.
• Personnel in charge of installing and maintaining FA systems.
• Personnel in charge of managing FA systems and facilities.
For programming, this manual is intended for personnel who understand the programming language
specifications in international standard IEC 61131-3 or Japanese standard JIS B 3503.
Applicable Products
This manual covers the following products.
Part of the specifications and restrictions for the CPU Units are given in other manuals. Refer to
Related Manuals on page 13.
Manual Structure
Special Information
Special information in this manual is classified as follows:
Additional Information
Version Information
Information on differences in specifications and functionality for CPU Units and Industrial PCs
with different unit versions and for different versions of the Sysmac Studio are given.
CONTENTS
Introduction .............................................................................................................. 1
Features of the Library................................................................................................................................. 1
Intended Audience....................................................................................................................................... 1
Applicable Products ..................................................................................................................................... 1
CONTENTS................................................................................................................ 4
Warranties
Exclusive Warranty
Omron’s exclusive warranty is that the Products will be free from defects in materials and workman-
ship for a period of twelve months from the date of sale by Omron (or such other period expressed in
writing by Omron). Omron disclaims all other warranties, express or implied.
Limitations
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF
THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE
PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE.
Omron further disclaims all warranties and responsibility of any type for claims or expenses based
on infringement by the Products or otherwise of any intellectual property right.
Buyer Remedy
Omron’s sole obligation hereunder shall be, at Omron’s election, to (i) replace (in the form originally
shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-com-
plying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal
to the purchase price of the non-complying Product; provided that in no event shall Omron be
responsible for warranty, repair, indemnity or any other claims or expenses regarding the Products
unless Omron’s analysis confirms that the Products were properly handled, stored, installed and
maintained and not subject to contamination, abuse, misuse or inappropriate modification. Return of
any Products by Buyer must be approved in writing by Omron before shipment. Omron Companies
shall not be liable for the suitability or unsuitability or the results from the use of Products in combi-
nation with any electrical or electronic components, circuits, system assemblies or any other materi-
als or substances or environments. Any advice, recommendations or information given orally or in
writing, are not to be construed as an amendment or addition to the above warranty.
Application Considerations
Suitability of Use
Omron Companies shall not be responsible for conformity with any standards, codes or regulations
which apply to the combination of the Product in the Buyer’s application or use of the Product. At
Buyer’s request, Omron will provide applicable third party certification documents identifying ratings
and limitations of use which apply to the Product. This information by itself is not sufficient for a com-
plete determination of the suitability of the Product in combination with the end product, machine, sys-
tem, or other application or use. Buyer shall be solely responsible for determining appropriateness of
the particular Product with respect to Buyer’s application, product or system. Buyer shall take applica-
tion responsibility in all cases.
NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO
ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS PROPERLY RATED AND
INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
Programmable Products
Omron Companies shall not be responsible for the user’s programming of a programmable Product, or
any consequence thereof.
Disclaimers
Performance Data
Data presented in Omron Company websites, catalogs and other materials is provided as a guide for
the user in determining suitability and does not constitute a warranty. It may represent the result of
Omron’s test conditions, and the user must correlate it to actual application requirements. Actual perfor-
mance is subject to the Omron’s Warranty and Limitations of Liability.
Change in Specifications
Product specifications and accessories may be changed at any time based on improvements and other
reasons. It is our practice to change part numbers when published ratings or features are changed, or
when significant construction changes are made. However, some specifications of the Product may be
changed without any notice. When in doubt, special part numbers may be assigned to fix or establish
key specifications for your application. Please consult with your Omron’s representative at any time to
confirm actual specifications of purchased Product.
Safety Precautions
WARNING
avoided, could result in death or serious injury. Addition-
ally, there may be severe property damage.
Caution
avoided, may result in minor or moderate injury, or
property damage.
Symbols
The circle and slash symbol indicates operations that you must not do.
The specific operation is shown in the circle and explained in text.
This example indicates prohibiting disassembly.
The filled circle symbol indicates operations that you must do.
The specific operation is shown in the circle and explained in text.
This example shows a general precaution for something that you must
do.
Warings
WARNING
Emergency stop circuits, interlock circuits, limit circuits, and similar safety measures
must be provided in external control circuits. Not doing so may result in serious acci-
dents due to incorrect operation.
Using this function block (FB) in a device, confirm that the program and FB operates
properly. Design a program so that safety measures such as fail-safe circuits are
implemented outside of the FB.
Cautions
Caution
Read all related manuals carefully before you use this library.
Check the user program, data, and parameter settings for proper execution before
you use them for actual operation.
Keep the emergency stop switch in hand to prevent a sudden operation of the motor
when you perform testing operation.
The sample programming shows only the portion of a program that uses the func-
tion or function block from the library.
When using actual devices, also program safety circuits, device interlocks, I/O with
other devices, and other control procedures.
Understand the contents of sample programming before you use the sample pro-
gramming and create the user program.
Operation
• The Sysmac Library and manuals are assumed to be used by personnel that is given in Intended
Audience in this manual. Otherwise, do not use them.
Operation
• Specify the input parameter values within the valid range.
• In the function or function block with an Enabled output variable, if the value of Enabled is FALSE, do
not use the processing result of the function or function block as a command value to the control tar-
get.
Related Manuals
The following are the manuals related to this manual. Use these manuals for reference.
Revision History
A manual revision code appears as a suffix to the catalog number on the front and back covers of the
manual.
Version Information
To use Sysmac Libraries, you need the Sysmac Studio version 1.14 or higher.
Device
3 Add the desired Sysmac Library to the list and click the OK Button.
LoadToTorque (Load-to-Torque Conversion)
G5-s
Position, velocity, and function
Servo
torque (load) monitoring TorqueToLoad (Torque-to-Load Conversion)
function
Load C
Unit
4 Insert the Sysmac Library’s function blocks and functions into the circuit using one of the follow-
ing two methods.
• Select the desired function block or function in the Toolbox and drag and drop it onto the pro-
gramming editor.
• Right-click the programming editor, select Insert Function Block in the menu, and enter the
fully qualified name (\\name of namespace\name of function block).
Device
3 Select an old-version Sysmac Library and click the Delete Reference Button.
4 Add the desired Sysmac Library to the list and click the OK Button.
Version Information
To use Sysmac Libraries, you need the Sysmac Studio version 1.14 or higher.
1 Start the Sysmac Studio and create a new project in which you want to use Sysmac Libraries.
2 Connect the computer to the CPU Unit or the Industrial PC and place it online.
4 Insert the Sysmac Library’s function blocks and functions into the circuit using one of the follow-
ing two methods.
• Select the desired function block or function in the Toolbox and drag and drop it onto the Lad-
der Editor.
• Right-click the programming editor, select Insert Function Block in the menu, and enter the
fully qualified name (\\name of namespace\name of function block).
System Configuration
The Servo Press Library assumes the following type of system configuration built around an
NJ/NX-series CPU Unit or an NY-series Industrial PC.
Operation commands are generated for a Servomotor that runs an actuator of a servo press according
to an operation pattern prepared in advance. Operation is controlled from the NA/NS-series PT, exter-
nal operation switches, and machine control programming.
The position and load/torque of the actuator used in the servo press are monitored and displayed as
waveforms on an HMI. The operation results and waveform data are saved in memory built into the
CPU Unit or in an SD Memory Card.
EtherNet/IP
G5-series Servomotor
EtherCAT
Load cell
Digital I/O Unit
Load Cell Input Unit
External operation switches,
display lamps, etc.
Press-fitting workpiece
Press-fitted workpiece
Load
Time
Step No. 1 2 3 4
SP_SingleAxisPrgOpr SP_SingleAxisCtrl
(Single-axis Program Motion instruction (Single-axis Control) Operation
Operation) function block parameters function block commands
The Single-axis Program Operation function block performs the following four operations.
• Program Status Control
The program operation data is interpreted, and the order of execution is controlled.
• Step Completion Determination
The transition condition for the program operation step is checked to determine when to end the step.
• Step Load Alarm Determination
The load data for each step is checked against a preset condition while program operation is in prog-
ress to determine if an alarm state has occurred.
• Program Load Alarm Determination
The load data is checked against a preset condition while program operation is in progress to deter-
mine if an alarm state has occurred.
This library also contains function blocks that perform these operations individually.
The user can combine multiple function blocks to achieve user-specific single-axis program operation.
G5-series Servo
Drive
SP_SingleAxisPrgOpr SP_SingleAxisCtrl
(Single-axis Program
Program Motion instruction (Single-axis Control) Operation
Operation) function block function block commands
operation data parameters
SP_StepCompleteJudge
(Step Completion G5-series
Determination) function Servomotor
block
SP_StepLoadAlarm (Step
Load Alarm Determination)
function block
SP_PrgLoadAlarm
(Program Load Alarm
Determination) function
block
Logging Servo Press Operations, Recording Trace Data, and Saving Data
to an SD Memory Card
The result for the operation for each step of single-axis program operation for servo press operation
and the trace data for the operation are recorded while operation is in progress. You can also save this
data in an SD Memory Card in CSV format.
PrgOpsRsltRec PrgOprRsltCSVWrite
(Program Operation (Program Operation
Result Recorder) Results SD Memory Card
G5-series Servo Execution Write) function block
function block results log
Drive Position,
torque, etc. Saved.
SD Memory Card
PrgOprTracePut PrgOprTraceCSVWrite
(Add Program (Program Operation Trace
Position, Operation Trace Recorder SD Memory
Records) function Trace data Card Write) function block
torque, etc.
G5-series
Saved.
Servomotor
SD Memory Card
G5-series Servo
Drive
XYDataRec (Broken-line
Graph Trace Data XYDataToGraph
Preparation) function (Broken Line Graph
Position, Trace data for
block Display Data
torque, etc. graphs
Conversion) function NA/NS-series PT
G5-series
Servomotor
Common Variables
This section describes the specifications of variables (EN, Execute, Enable, Abort, ENO, Done, Cal-
cRslt, Enabled, Busy, CommandAborted, Error, ErrorID, and ErrorIDEx) that are used for more than
one function or function block. The specifications are described separately for functions, for exe-
cute-type function blocks, and for enable-type function blocks.
Function/function
block type to use
Data
Variable I/O Function block Meaning Definition
type
Execute- Enable- Function
type type
EN Input BOOL OK Execute The processing is executed while the
variable is TRUE.
Execute OK Execute The processing is executed when the
variable changes to TRUE.
Enable OK Run The processing is executed while the
variable is TRUE.
Abort BOOL OK Abort The processing is aborted.
You can select the aborting method.
Function/function
block type to use
Data
Variable I/O Function block Meaning Definition
type
Execute- Enable- Function
type type
ENO Output BOOL OK Done The variable changes to TRUE when the
processing ends normally.
It is FALSE when the processing ends in
an error, the processing is in progress, or
the execution condition is not met.
Done BOOL OK Done The variable changes to TRUE when the
processing ends normally.
It is FALSE when the processing ends in
an error, the processing is in progress, or
the execution condition is not met.
Busy BOOL OK OK Executing The variable is TRUE when the process-
ing is in progress.
It is FALSE when the processing is not in
progress.
CalcRslt LREAL OK Calculation The calculation result is output.
Result
Enabled BOOL OK Enabled The variable is TRUE when the output is
enabled. It is used to calculate the con-
trol amount for motion control, tempera-
ture control, etc.
Command BOOL OK Command The variable changes to TRUE when the
Aborted Aborted processing is aborted.
It changes to FALSE when the process-
ing is re-executed the next time.
Error BOOL OK OK Error This variable is TRUE while there is an
error.
It is FALSE when the processing ends
normally, the processing is in progress,
or the execution condition is not met.
ErrorID WORD OK OK Error Code An error code is output.
ErrorIDEx DWORD OK OK Expansion An expansion error code is output.
Error Code
Abcd_instance
Abcd
InOut_Val InOut_Val
In-out variables In-out variables
Execute Done
Busy
CommandAborted
Input variables Output variables
Error
ErrorID
ErrorIDEx
• If Execute is TRUE and Done, CommandAborted, or Error changes to TRUE, Done, Command-
Aborted, and Error changes to FALSE when Execute is changed to FALSE.
• If Execute is FALSE and Done, CommandAborted, or Error changes to TRUE, Done,Command-
Aborted, and Error changes to TRUE for only one task period.
• If an error occurs, the relevant error code and expansion error code are set in ErrorID (Error Code)
and ErrorIDEx (Expansion Error Code). The error codes are retained even after Error changes to
FALSE, but ErrorID is set to 16#0000 and ErrorIDEx is set to 16#0000 0000 when Execute changes
to TRUE.
Timing Charts
This section provides timing charts for a normal end, aborted execution, and errors.
Normal End
Execute
Done
Busy
CommandAborted
Error
ErrorID 16#0000
ErrorIDEx 16#00000000
Canceled Execution
Execute
Abort
Busy
CommandAborted
Error
ErrorID 16#0000
ErrorIDEx 16#00000000
Aborted Execution
Execute
Done
Busy
CommandAborted
Error
ErrorID 16#0000
ErrorIDEx 16#00000000
Errors
Execute
Done
Busy
CommandAborted
Error
Abcd_instance
Abcd
InOut_Val InOut_Val
In-out variables In-out variables
Enable Enabled
CalcRslt
Input variables Busy
Output variables
Error
ErrorID
ErrorIDEx
• If an error occurs, the relevant error code and expansion error code are set in ErrorID (Error Code)
and ErrorIDEx (Expansion Error Code). The error codes are retained even after Error changes to
FALSE, but ErrorID is set to 16#0000 and ErrorIDEx is set to 16#0000 0000 when Enable changes to
TRUE.
• For function blocks that calculate the control amount for motion control, temperature control, etc.,
Enabled is FALSE when the value of CalcRslt (Calculation Result) is incorrect. In such a case, do not
use CalcRslt. In addition, after the function block ends normally or after an error occurs, the value of
CalcRslt is retained until Enable changes to TRUE. The control amount will be calculated based on
the retained CalcRslt value, if it is the same instance of the function block that changed Enable to
TRUE. If it is a different instance of the function block, the control amount will be calculated based on
the initial value.
Timing Charts
This section provides timing charts for a normal end and errors.
Normal End
Enable
Enabled
Retained
CalcRslt Retained
Busy
Error
ErrorID 16#0000
ErrorIDEx 16#00000000
Errors
Enable
Enabled
Retained
CalcRslt Retained
Busy
Error
Precautions
This section provides precautions for the use of this function block.
Nesting
You can nest calls to this function block for up to four levels.
For details on nesting, refer to the software user’s manual.
Instruction Options
You cannot use the upward differentiation option for this function block.
SP_SingleAxisPrgOpr
The SP_SingleAxisPrgOpr function block executes single-axis program operation that combines multiple sin-
gle-axis motion controls.
Function
FB/
block Name Graphic expression ST expression
FUN
name
SP_Single Sin- FB SP_SingleAxisPrgOpr_instance (
AxisPrg gle-axis SP_SingleAxisPrgOpr_Instance PrgTable,
Opr Program \\OmronLib\ServoPress\SP_SingleAxisPrgOpr PrgLoadAlarm,
PrgTable PrgTable
Opera- Execute,
tion PrgLoadAlarm PrgLoadAlarm Abort,
StartStepNo,
Execute Done
SingleMode,
Abort MCCmdExec Position,
Velocity,
StartStepNo SingleCmdProfile
Load,
SingleMode CurrentStepNo MCCmdDone,
StepCompleteCode,
Position StepLoadAlarmOut SingleCmdProfileNo,
Velocity PrgLoadAlarmOut Done,
MCCmdExec,
Load ExtrOutputCode SingleCmdProfile,
CurrentStepNo,
MCCmdDone StepExec
StepLoadAlarmOut,
StepCompleteCode StepCompleted PrgLoadAlarmOut,
ExtrOutputCode,
SingleCmdProfileNo Busy
StepExec,
CommandAborted StepCompleted,
Busy,
Error
CommandAborted,
ErrorID Error,
ErrorID,
ErrorIDEx ErrorIDEx);
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00071
Publish/Do not publish source code Not published.
Function block and function version 1.00
Variables
Input Variables
*1. The unit of load is not specified in this function block. Uniquely set newtons (N) or % as a torque conversion
value in the user program that uses this function block.
Output Variables
Structure
The data type of the SingleCmdProfile output variable is the structure OmronLib\ServoPress\sSIN-
GLE_CMD_PROFILE. The specifications are as follows:
_mcBlendingNext: Blending
next
_mcBlendingHigh: Blending
high
Torque
Torque The torque set value. LREAL *1 % 0
Set Value
Torque
Torque
Ramp Set The torque ramp set value. LREAL *1 %/s 0
Ramp
Value
This variable indicates
Torque Enable whether to enable the posi-
Limit Positive tive torque limit. Depends on
BOOL --- FALSE
Positive Torque data type.
TRUE: Enabled.
Enable Limit
FALSE: Disabled
This variable indicates
Torque Enable whether to enable the nega-
Limit Negative tive torque limit. Depends on
BOOL --- FALSE
Negative Torque data type.
TRUE: Enabled.
Enable Limit
FALSE: Disabled
Torque
Positive
Limit 0.0 or 0.1 to
Torque The positive torque limit. LREAL % 300.0
Positive 1000.0
Limit
Val
Torque
Negative
Limit 0.0 or 0.1 to
Torque The negative torque limit. LREAL % 300.0
Negative 1000.0
Limit
Val
Omron-
Torque
Lib\Servo-
TorqueFbk Feedback Torque feedback control
Press\sTORQ *1 --- ---
Params Parame- parameters
UE_FBK_PAR
ters
AMS
Propor-
Kp tional The proportional gain. LREAL 0.0 to 3000.0 --- 1.0
Gain
In-Out Variables
Structure
The data type of the PrgTable in-out variable is the structure OmronLib\ServoPress\sPRG_TABLE.
The specifications are as follows:
The data type of the PrgLoadAlarm in-out variable is the structure OmronLib\ServoPress\sPRG_-
LOAD_ALARM. The specifications are as follows:
Function
This function block executes single-axis program operation that combines multiple motion controls,
including position control, velocity control, torque control, and torque feedback control in combination
with the SingleAxisCtrl (Single-axis Control) function block.
This function block also performs the following.
• Performs step load alarm determination for each step of the single-axis program operation.
• Performs program load alarm determination through the entire single-axis program operation.
(Example 2) In the step for which CtrlCode is set to 0 (single-axis program operation completion)
and CompleteType is set to 1 (target absolute position), if the Position (Current Position) input
variable in this function block becomes to AbsolutePosition (i.e., a condition of end) according the
MC_Stop instruction executed in the SingleAxisCtrl function block, Done changes to TRUE and
this function block is completed.
• Controls up to PrgTable[50] are executed.
• Execution of the step specified with StartStepNo (Execution Start Step Number) is completed
when SingleMode is TRUE.
• A timeout occurred during a step for which TimeOutNextStepNo is set to USINT#0.
• A step for which UnachievedNextStepNo is set to USINT#0 was not completed.
The stages of single-axis program operation given in the array elements of PrgTable are called
steps. Also, the element numbers in PrgTable are called the step numbers. The flow of a series of
steps is called the step sequence.
The PrgTable array size is 50. Therefore, you can set a maximum of 50 single-axis program opera-
tion steps.
Value of CtrlCode Control method Motion control instruction or motion control function
Single-axis program opera-
0 MC_Stop Instruction
tion completion
1 Absolute positioning MC_MoveAbsolute (Absolute Positioning) instruction
2 Relative positioning MC_MoveRelative (Relative Positioning) instruction
3 CSV mode velocity control CSV mode velocity control
4 Torque control MC_TorqueControl (Torque Control) instruction
5 Torque feedback control Torque feedback control
6 Operation hold ---
7 Skip ---
Operation Hold
When CtrlCode is set to USINT#6, motion control instructions are not executed in the SingleAxisCtrl
(Single-axis Control) function block. Therefore, the motion control instruction operation that was
executed in the previous step is held.
Velocity
Step 1 Step 2 Step 3
CSV mode velocity Operation Relative positioning
control hold
MC_Axis000
Velocity Profile
Time
Skip
If CtrlCode is set to USINT#7, the function block immediately moves to the next step. This control
method is called skipping.
The meanings of the step completion types and the meaning of timeout are explained below.
Position StepCompleteData.InPosWidth
AbsolutePosition
Current position
of the axis
Current
position of
the axis
Step started. Step ended. Time
Velocity
StepCompleteData.Velocity
Step ended.
Step started.
Current velocity of
the monitoring
target
Position
MonitorMinPos MonitorMaxPos
It is determined that the step is completed when MonitorMinPos = MonitorMaxPos, regardless of the
current position of the monitoring target.
Load value
Step ended.
StepCompleteData.Load
Position
MonitorMinPos MonitorMaxPos
It is determined that the step is completed when MonitorMinPos = MonitorMaxPos, regardless of the
current position of the monitoring target.
Load value
Step started.
Current load value of
the monitoring target
Step ended.
StepCompleteData.Load
Position
It is determined that the step is completed when MonitorMinPos = MonitorMaxPos, regardless of the
current position of the monitoring target.
Load for the current task period - Load for the previous task period
Position load gradient =
Current position in the current task period - Current position in the previous task period
It is determined that the step is completed when the relation between the current load gradient and
the value of InflPointGradient (Position Load Gradient) satisfies the following formula in consecutive
task periods for more than InflPointGradientCount (Number of Consecutive Position Load Gradi-
ents).
• InflPointGradient > 0
Position load gradient > InflPointGradient
• InflPointGradient < 0
Position load gradient < InflPointGradient
However, step completion is only determined when the current position of the monitoring target is
between (MonitorMinPos (Minimum Monitoring Position) + StepCompleteData.InPosWidth (Posi-
tioning In-position Width)) and (MonitorMaxPos (Maximum Monitoring Position) - StepComplete-
Data.InPosWidth). If the step is not completed even when the current position of the monitoring
target exceeds MonitorMinPos − StepCompleteData.InPosWidth, the step is ended immediately,
and processing moves to the step specified with UnachievedNextStepNo (Step Number When Step
Not Completed). The single-axis program operation ends if UnachievedNextStepNo is USINT#0.
The following conceptual diagram illustrates a continuous detection of position load gradient.
Load value
Step ended.
The number of consecutive task periods with a
gradient that exceeds InflPointGradient equals
InflPointGradientCount or higher.
Previous task period
Step started.
Position
MonitorMinPos MonitorMaxPos
It is determined that the step is completed when MonitorMinPos = MonitorMaxPos, regardless of the
current position of the monitoring target.
Step completion
Current load for determination range
the axis
The load decrease continues for LoadDecreaseCount
Load value or more times.
Step ended.
Step started.
Load value
Step ended.
Step started.
Timeout
If the step is not completed even if the time set in TimeOut (Step Timeout Time) has elapsed from
the start of the step, it will be determined that the step timed out. If a timeout occurs, the process
moves to the step specified in TimeOutNextStepNo (Step Timeout Next Step Number). The sin-
gle-axis program operation ends when TimeOutNextStepNo is USINT#0.
SP_SingleAxisPrgOpr SingleAxisCtrl
SingleCmdProfile SingleCmdProfile
Value of CtrlCode
1: Absolute posi-
Member 0: Deceleration tioning 5: Torque feed-
3: Velocity control 4: Torque control
stop 2: Relative posi- back control
tioning
Positive number,
Position --- negative number or --- --- ---
0
Positive number,
Positive number or Positive number or
Velocity --- Positive number negative number or
0 0
0
Positive number or Positive number or
Acceleration --- --- ---
0 0
Positive number or Positive number or Positive number or
Deceleration --- ---
0 0 0
Positive number or Positive number or
Jerk --- --- ---
0 0
_mcPositiveDirec-
tion
_mcShortestWay _mcPositiveDirec-
_mcNegativeDirec- tion
Direction --- --- ---
tion _mcNegativeDirec-
_mcCurrentDirec- tion
tion
_mcNoDireciton
_mcAborting
_mcBuffered
_mcBlendingLow
Buffer _mcAborting
_mcAborting _mcBlendingPrevi- --- ---
Mode _mcBuffered
ous
_mcBlendingNext
_mcBlendingHigh
Torque --- --- --- 0 to 1000.0 −1,000.0 to 1,000.0
Torque Positive number or Positive number or
--- --- ---
Ramp 0 0
Torque
Limit
TRUE or FALSE TRUE or FALSE TRUE or FALSE TRUE or FALSE TRUE or FALSE
Positive
Enable
Torque
Limit
TRUE or FALSE TRUE or FALSE TRUE or FALSE TRUE or FALSE TRUE or FALSE
Negative
Enable
Torque
Limit
0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0
Positive
Val
Value of CtrlCode
1: Absolute posi-
Member 0: Deceleration tioning 5: Torque feed-
3: Velocity control 4: Torque control
stop 2: Relative posi- back control
tioning
Torque
Limit
0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0 0.0 or 0.1 to 1000.0
Negative
Val
TorqueFbk *1
--- --- --- ---
Params
*1. For details, refer to Torque Feedback Control Function on page 162.
Value of Step-
Current position of the axis Load value
LoadAlarmOut
Less than (MonitorMinPos + StepLoadA-
--- FALSE
larm.InPosWidth)
Less than MonitorMinLoad TRUE
Between (MonitorMinPos + StepLoadA-
Between MonitorMinLoad and
larm.InPosWidth) and (MonitorMaxPos - StepLoad- FALSE
MonitorMaxLoad, inclusive
Alarm.InPosWidth)
Greater than MonitorMaxLoad. TRUE
Greater than (MonitorMaxPos − StepLoadA-
--- FALSE
larm.InPosWidth)
The relations given in the above table are illustrated in the following diagram.
StepLoadAlarm.InPosWidth
Load value
MonitorMinLoad
Value of Step-
Current position of the axis Load value
LoadAlarmOut
Less than (MonitorMinPos + StepLoadA-
--- TRUE
larm.InPosWidth)
Less than MonitorMinLoad TRUE
Between (MonitorMinPos + StepLoadA-
Between MonitorMinLoad and
larm.InPosWidth) and (MonitorMaxPos - StepLoad- FALSE
MonitorMaxLoad, inclusive
Alarm.InPosWidth)
Greater than MonitorMaxLoad. TRUE
Greater than (MonitorMaxPos − StepLoadA-
--- TRUE
larm.InPosWidth)
The relations given in the above table are illustrated in the following diagram.
StepLoadAlarm.InPosWidth
Load value
MonitorMinLoad
Load value
LoadMaxUpper
Trapezoid area
LoadMaxLower
LoadMinUpper
LoadMinLower
You can set the current position of the axis as the reference type to evaluate outside the time
elapsed from the execution of this function block. To do so, read the above figure as if MonitorUp-
perTime were replaced with (MonitorUpperPos + PrgLoadAlarm.InPosWidth) and MonitorLower-
Time as if it were replaced with (MonitorLowerPos − PrgLoadAlarm.InPosWidth).
Set the reference type to evaluate with UnitType (Standard Type), as given in the following table.
You can select whether to perform error determination when the load is within the trapezoid area or
when the load is outside the trapezoid area. The following table shows how to set AlarmType (Alarm
Type) to specify whether error determination is performed inside or outside the area.
Load error determination is not performed when the elapsed time is not between MonitorUpperTime
and MonitorLowerTime, inclusive. If that is the case, the value of PrgLoadAlarmOut changes to
FALSE.
The following table shows the relation between the elapsed time, the value of AlarmType, the load,
and the value of PrgLoadAlarmOut.
The relations given in the above table are illustrated in the following diagram.
• AlarmType = USINT#1
Load value
LoadMaxUpper
• AlarmType = USINT#2
Load value
LoadMaxUpper
MonitorLowerTime MonitorUpperTime
Elapsed time
TrapezoidData (Trapezoid Area) is a size 5 array. Therefore, you can set a maximum of five trape-
zoid areas.
Load value
LoadMaxLimit
Rectangle area
LoadMinLimit
You can select whether to perform error determination when the load is within the rectangle area or
when the load is outside the rectangle area. The following table shows how to set AlarmType (Alarm
Type) to specify whether error determination is performed inside or outside the area.
Load error determination is not performed when the elapsed time is not between MonitorUpperTime
and MonitorLowerTime, inclusive. If that is the case, the value of PrgLoadAlarmOut changes to
FALSE.
The following table shows the relation between the elapsed time, the value of AlarmType, the load,
and the value of PrgLoadAlarmOut.
The relations given in the above table are illustrated in the following diagram.
• AlarmType = USINT#1
Load value
LoadMaxLimit
PrgLoadAlarmOut = TRUE
Load value
LoadMaxLimit
PrgLoadAlarmOut = TRUE
Meanings of Variables
The meanings of the other variables are described below.
Timing Charts
The timing charts for the SP_SingleAxisPrgOpr function block are given together with the timing charts
for the SingleAxisCtrl (Single-axis Control) function block that is connected after it.
The following timing chart shows the operation patterns given in the sample programming of this func-
tion block. The behavior of output variables in the SingleAxisCtrl (Single-axis Control) function block will
change according to the settings of PrgTable (Program Tables).
Normal End
• Busy (Executing) changes to TRUE when Execute in the function block changes to TRUE. If
MCCmdExec (Motion Function Block Execution Trigger) changes to TRUE in the same task
period, Busy (Executing) in the SingleAxisCtrl (Single-axis Control) function block also changes to
TRUE.
• When the step sequence is completed, the execution of the function block is ended. When Busy
changes to FALSE, Done changes to TRUE. The example in the following figure uses four steps.
• Step completion determination is performed based on StepCompleteData (Step Completion Con-
dition), so the completion of the execution of the SingleAxisCtrl (Single-axis Control) function
block may lag behind the completion of the execution of the SP_SingleAxisPrgOpr function block.
• ExtrOutputCode (External Output Code) is output when execution of the next step after the com-
pleted step starts.
• The value of ExtrOutputCode (External Output Code) in the final step is retained even after Done
changes to TRUE.
SP_SingleAxisPrgOpr FB
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
Done
FALSE
MCCmdExec[0] TRUE
FALSE
ExtrOutputCode 0 1 2 3 4
SingleAxisCtrl FB
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
CommandAborted
FALSE
Velocity
MC_Axis000
Velocity Profile
Time
Step No.1 Step No.2 Step No.3
Step No.4 (End)
Aborting Execution
The following timing chart gives an example when executing the MC_Stop (Stop) instruction at the
same time as Abort in this function block is executed.
• When the value of Abort is changed to TRUE, the processing is aborted.
• The value of ExtrOutputCode (External Output Code) that is being output when processing is
aborted is retained even after processing is aborted.
SP_SingleAxisPrgOpr FB
Execute TRUE
FALSE
TRUE
Abort
FALSE
TRUE
Busy
FALSE
TRUE
Done
FALSE
TRUE
CommandAborted
FALSE
MCCmdExec[0] TRUE
FALSE
ExtrOutputCode 0 1
SingleAxisCtrl FB
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
CommandAborted
FALSE
MC_Stop Instruction
TRUE
Execute
FALSE
Velocity
MC_Axis000
Velocity Profile
Time
Step No.1 Step No.2
Error End
The following timing chart gives an example when a control method outside the range is specified to
StepCmdData (Step Command Data) in the third step of PrgTable (Program Tables).
• If an error occurs during execution of this function block, Error changes to TRUE for two task peri-
ods. You can find out the cause of the error by referring to the values output by ErrorID (Error
Code) and ErrorIDEx (Expansion Error Code).
• The value of ExtrOutputCode (External Output Code) that is being output when an error occurs is
retained even after the function block is ended for the error.
SP_SingleAxisPrgOpr FB
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
Done
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 16#3C4A
ErrorIDEx 16#0000 0000 16#0003 0003
MCCmdExec[0] TRUE
FALSE
ExtrOutputCode 0 1 2
SingleAxisCtrl FB
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
CommandAborted
FALSE
Velocity
MC_Axis000
Velocity Profile
Time
Step No.1 Step No.2 Step No.3 (Error occurs.)
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections are given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3C4A 16#00000001 Execution start The value of StartStepNo (Exe- Check the valid range of the
step number cution Start Step Number) value of StartStepNo (Execution
range exceeded the valid range. Start Step Number) and set the
exceeded value within the valid range.
16#00000002 Next step num- The value of NextStepNo (Next Check the valid range of the
ber range Step Number) exceeded the value of NextStepNo (Next Step
exceeded valid range. Number) and set the value within
the valid range.
16# 0003 Control method The value of CtrlCode (Control Check the valid range of the
*1 range Method) is outside the valid value of CtrlCode (Control
exceeded range. Method) and set the value within
the valid range.
16#00000004 Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
16#3C4B 16# 0001* Step timeout The value of TimeOut (Step Tim- Check the valid range of the
1 time out of eout Time) is outside the valid value for TimeOut (Step Timeout
range range. Time) and set the value within the
valid range.
16# 0002 Step timeout The value of TimeOutNext- Check the valid range of the
*1 next step num- StepNo (Step Timeout Next Step value for TimeOutNextStepNo
ber out of range Number) is outside the valid (Step Timeout Next Step Num-
range. ber) and set the value within the
valid range.
16# 0003 Illegal monitor- The value of MonitorMinPos Set MonitorMinPos (Minimum
*1 ing position (Minimum Monitoring Position) is Monitoring Position) to a value
greater than the value of that is less than or equal to the
MonitorMaxPos (Maximum value of MonitorMaxPos (Maxi-
Monitoring Position). mum Monitoring Position).
16# 0004 Monitoring start The value of MonitorStartTime Check the valid range of the
*1 time out of (Monitoring Start Time) is outside value for MonitorStartTime (Moni-
range the valid range. toring Start Time) and set the
value within the valid range.
16# 0005 Monitoring end The value of MonitorEndTime Check the valid range of the
*1 time out of (Monitoring End Time) is outside value for MonitorEndTime (Moni-
range the valid range. toring End Time) and set the
value within the valid range.
16# 0006 Illegal monitor- The value of MonitorStartTime Set MonitorStartTime (Monitor-
*1 ing time (Monitoring Start Time) is greater ing Start Time) to a value that is
than the value of MonitorEnd- less than or equal to the value of
Time (Monitoring End Time). MonitorEndTime (Monitoring End
Time).
Expansion error
Error code Status Description Correction
code
16#3C4B 16# 0007 Number of con- The value of InflPointGradient- Check the valid range for the
*1 secutive posi- Count (Number of Consecutive value of InflPointGradientCount
tion load Position Load Gradients) is out- (Number of Consecutive Posi-
gradients out of side the valid range. tion Load Gradients) and set the
range value within the valid range.
16# 0008 Number of con- The value of LoadDecreaseC- Check the valid range for the
*1 secutive load ount (Number of Consecutive value of LoadDecreaseCount
decreases Load Reductions Threshold) is (Number of Consecutive Load
threshold out of outside the valid range. Reductions Threshold) and set
range the value within the valid range.
16# 0009 Number of con- The value of LoadIncreaseCount Check the valid range for the
*1 secutive load (Number of Consecutive Load value of LoadIncreaseCount
increases Increases Threshold) is outside (Number of Consecutive Load
threshold out of the valid range. Increases Threshold) and set the
range value within the valid range.
16# 000A Step number The value of UnachievedNext- Check the valid range of the
*1 when step not StepNo (Step Number When value for UnachievedNextStepNo
completed Step Not Completed) is outside (Step Number When Step Not
the valid range. Completed) and set the value
within the valid range.
16# 000B Wait time out of The value of WaitTime (Wait Check the valid range of the
*1 range Time) is outside the valid range. value for WaitTime (Wait Time)
and set the value within the valid
range.
16# 000C Position load The value of InflPointGradient Check the valid range for the
*1 gradient out of (Position Load Gradient) is out- value of InflPointGradient (Posi-
range side the valid range. tion Load Gradient) and set the
value within the valid range.
16# 000D Step completion The value of CompleteType Check the valid range of the
*1 type out of (Step Completion Type) value for CompleteType (Step
range exceeded the valid range. Completion Type) and set the
value within the valid range.
16# 000E Positioning The value of InPosWidth (Posi- Check the valid range of the
*1 in-position width tioning In-position Width) is out- value for InPosWidth (Positioning
out of range side the valid range. In-position Width) and set the
value within the valid range.
16#0000000F Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
Expansion error
Error code Status Description Correction
code
16#3C4C 16# 0001* Illegal monitor- The value of MonitorMinPos Set MonitorMinPos (Monitoring
1 ing position (Monitoring Range Minimum Range Minimum Position) to a
Position) is greater than the value that is less than or equal to
value of MonitorMaxPos the value of MonitorMaxPos
(Monitoring Range Maximum (Monitoring Range Maximum
Position). Position).
16# 0002 Illegal monitor- The value of MonitorMinLoad Set MonitorMinLoad (Monitoring
*1 ing load (Monitoring Load Range Lower Load Range Lower Limit) to a
Limit) is greater than the value of value that is less than or equal to
MonitorMaxLoad (Monitoring the value of MonitorMaxLoad
Load Range Upper Limit). (Monitoring Load Range Upper
Limit).
16# 0003 Step load Alarm The value of StepAlarmType Check the valid range of the
*1 determination (Step Load Alarm Determination value for StepAlarmType (Step
type out of Type) is outside the valid range. Load Alarm Determination Type)
range and set the value within the valid
range.
16# 0004 Upper/lower The value of InPosWidth Check the valid range of the
*1 monitoring limit (Upper/Lower Monitoring Limit value for InPosWidth
in-position width In-position Width) is outside the (Upper/Lower Monitoring Limit
out of range valid range. In-position Width) and set the
value within the valid range.
16#00000005 Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
Expansion error
Error code Status Description Correction
code
16#3C4D 16#00000001 Program load The value of PrgAlarmType (Pro- Check the valid range of the
alarm gram Load Alarm Determination value for PrgAlarmType (Pro-
determination Type) is outside the valid range. gram Load Alarm Determination
type out of Type) and set the value within the
range valid range.
16#00000002 Standard type The value of UnitType (Standard Check the valid range of the
out of range Type) is outside of the valid value for UnitType (Standard
range. Type) and set the value within the
valid range.
16#00000003 Trapezoid area The value of Check the valid range of the
data alarm type TrapezoidData.AlarmType value for TrapezoidData.Alarm-
out of range (Alarm Type) is outside of the Type (Alarm Type) and set the
valid range. value within the valid range.
16#00000004 Trapezoid area The value of Check the valid range of the
data monitoring TrapezoidData.MonitorLowerTim value for TrapezoidData.Monitor-
lower limit e (Monitoring Lower Limit LowerTime (Monitoring Lower
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#00000005 Trapezoid area The value of Check the valid range of the
data monitoring TrapezoidData.MonitorUpperTim value for TrapezoidData.Moni-
upper limit e (Monitoring Upper Limit torUpperTime (Monitoring Upper
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#00000006 Illegal trape- The value of Set TrapezoidData.MonitorLow-
zoid area data TrapezoidData.MonitorLowerTim erTime (Monitoring Lower Limit
monitoring e (Monitoring Lower Limit Elapsed Time) to a value that is
lower limit Elapsed Time) is greater than less than or equal to the value of
elapsed time the value of TrapezoidData.MonitorUpper-
TrapezoidData.MonitorUpperTim Time (Monitoring Upper Limit
e (Monitoring Upper Limit Elapsed Time).
Elapsed Time).
16#00000007 Illegal trape- The value of Set TrapezoidData.MonitorLow-
zoid area data TrapezoidData.MonitorLowerPos erPos (Minimum Monitoring Posi-
monitoring posi- (Minimum Monitoring Position) is tion) to a value that is less than or
tion greater than the value of equal to the value of Trapezoid-
TrapezoidData.MonitorUpperPos Data.MonitorUpperPos (Maxi-
(Maximum Monitoring Position). mum Monitoring Position).
Expansion error
Error code Status Description Correction
code
16#3C4D 16#00000008 Illegal trape- The value of Set the value of Trapezoid-
zoid area data TrapezoidData.LoadMinLower Data.LoadMinLower (Monitoring
monitoring start (Monitoring Start Point Minimum Start Point Minimum Load) to a
point load Load) is greater than the value of value that is less than or equal to
TrapezoidData.LoadMaxLower the value of TrapezoidData.Load-
(Monitoring Start Point Maximum MaxLower (Monitoring Start Point
Load). Maximum Load).
16#00000009 Illegal trape- The value of Set the value of Trapezoid-
zoid area data TrapezoidData.LoadMinUpper Data.LoadMinUpper (Monitoring
monitoring end (Monitoring End Point Minimum End Point Minimum Load) to a
point load Load) is greater than the value of value that is less than or equal to
TrapezoidData.LoadMaxUpper the value of TrapezoidData.Load-
(Monitoring End Point Maximum MaxUpper (Monitoring End Point
Load). Maximum Load).Set the value of
TrapezoidData.LoadMinUpper
(Monitoring End Point Minimum
Load) to a value that is less than
or equal to the value of Trape-
zoidData.LoadMaxUpper (Moni-
toring End Point Maximum Load).
16#0000000A Rectangle area The value of Check the valid range of the
data alarm type RectangleData.AlarmType value for RectangleData.Alarm-
out of range (Alarm Type) is outside of the Type (Alarm Type) and set the
valid range. value within the valid range.
16#0000000B Rectangle area The value of Check the valid range of the
data monitoring RectangleData.MonitorLowerTi value for RectangleData.Monitor-
lower limit me (Monitoring Lower Limit LowerTime (Monitoring Lower
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#0000000C Rectangle area The value of Check the valid range of the
data monitoring RectangleData.MonitorUpperTi value for RectangleData.Moni-
upper limit me (Monitoring Upper Limit torUpperTime (Monitoring Upper
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#0000000D Illegal rectan- The value of Set RectangleData.MonitorLow-
gle area data RectangleData.MonitorLowerTi erTime (Monitoring Lower Limit
monitoring me (Monitoring Lower Limit Elapsed Time) to a value that is
lower limit Elapsed Time) is greater than less than or equal to the value of
elapsed time the value of RectangleData.MonitorUpper-
RectangleData.MonitorUpperTi Time (Monitoring Upper Limit
me (Monitoring Upper Limit Elapsed Time).
Elapsed Time).
16#0000000E Illegal rectan- The value of Set RectangleData.MonitorLow-
gle area data RectangleData.MonitorLowerPo erPos (Minimum Monitoring Posi-
monitoring posi- s (Minimum Monitoring Position) tion) to a value that is less than or
tion is greater than the value of equal to the value of Rectangle-
RectangleData.MonitorUpperPo Data.MonitorUpperPos (Maxi-
s (Maximum Monitoring mum Monitoring Position).
Position).
Expansion error
Error code Status Description Correction
code
16#3C4D 16#0000000F Illegal rectan- The value of Set the value of Rectangle-
gle area data RectangleData.LoadMinLimit Data.LoadMinLimit (Load Lower
load (Load Lower Limit) is greater Limit) to a value that is less than
than the value of or equal to the value of Rectan-
RectangleData.LoadMaxLimit gleData.LoadMaxLimit (Load
(Load Upper Limit). Upper Limit).
16#00000010 Illegal trape- The positional relationships Set the values of
zoid area data between the values of TrapezoidData.MonitorLowerTim
TrapezoidData.MonitorLowerTim e (Monitoring Lower Limit
e (Monitoring Lower Limit Elapsed Time),
Elapsed Time), TrapezoidData.MonitorUpperTim
TrapezoidData.MonitorUpperTim e (Monitoring Upper Limit
e (Monitoring Upper Limit Elapsed Time),
Elapsed Time), TrapezoidData.MonitorLowerPos
TrapezoidData.MonitorLowerPos (Minimum Monitoring Position),
(Minimum Monitoring Position), TrapezoidData.MonitorUpperPos
TrapezoidData.MonitorUpperPos (Maximum Monitoring Position),
(Maximum Monitoring Position), TrapezoidData.LoadMinLower
TrapezoidData.LoadMinLower (Monitoring Start Point Minimum
(Monitoring Start Point Minimum Load),
Load), TrapezoidData.LoadMaxLower
TrapezoidData.LoadMaxLower (Monitoring Start Point Maximum
(Monitoring Start Point Maximum Load),
Load), TrapezoidData.LoadMinUpper
TrapezoidData.LoadMinUpper (Monitoring End Point Minimum
(Monitoring End Point Minimum Load), and
Load), and TrapezoidData.LoadMaxUpper
TrapezoidData.LoadMaxUpper (Monitoring End Point Maximum
(Monitoring End Point Maximum Load) so that the enclosed area
Load) do not form a trapezoid. is a trapezoid.
16#00000011 Upper/lower The value of InPosWidth Check the valid range of the
monitoring limit (Upper/Lower Monitoring Limit value for InPosWidth
in-position width In-position Width) is outside the (Upper/Lower Monitoring Limit
out of range valid range. In-position Width) and set the
value within the valid range.
16#00000012 Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
*1. The boxes () are the BCD values of CurrentStepNo (Current Step Number) when the error occurred. For example,
if CurrentStepNo is USINT#11, ErrorIDEx is DWORD#16#00110001.
Sample Programming
This sample programming shows how to use single-axis program operation for absolute positioning
accompanied by torque control. The SP_SingleAxisPrgOpr (Single-axis Program Operation) and Sin-
gleAxisCtrl (Single-axis Control) function blocks are used for single-axis program operation, and the
MC_SetTorqueLimit (Torque Control) instruction is used to perform torque control.
Conditions
The following figure shows a system configuration for the sample programming.
Servomotor
NJ/NX-series CPU Unit Servo Drive
(servo press
actuator)
EtherCAT
Load cell
• MC_Axis000 is allocated to the Servomotor as a axis. The display unit for the axis is millimeters.
• The unit for the load measurement value that is input by the load cell is newtons. In the program
operation data for single-axis program operation, the measurement value is converted to a torque
and handled as a percentage of the Servomotor’s rated torque. The sample programming uses the
LoadToTorque (Load-to-Torque Conversion) function to convert the units.
Processing
1 Confirm that the axis can communicate and then turn ON the servo.
3 Change the StartPG variable to TRUE after home has been defined to start single-axis program
operation.
Single-axis program operation uses the following type of operation pattern. It is set when the
StartPG variable changes to TRUE.
Position [mm]
200.0
100.0
50.0
Time
Velocity [mm/s]
200.0
100.0
50.0
Time
StartPG No torque
Torque limit: 20% limit Torque limit: 50%
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PWR MC_Power Instance of the MC_Power (Power
Servo) instruction
HM MC_Home Instance of the MC_Home (Home)
instruction
SET_TRQ_LMT MC_SetTorqueLimit Instance of the MC_SetTorque-
Limit (Set Torque Limit) instruction
MV MC_Move Instance of the MC_Move (Posi-
tioning) instruction
STP MC_Stop Instance of the MC_Stop (Stop)
instruction
Initial
Name Data Type Comment
Value
SINGLE_AXIS_PRG_OPR OmronLib\ServoPress\SP_Sin- Instance of the SP_SingleAxisPr-
gleAxisPrgOpr gOpr (Single-axis Program Opera-
tion) function block
SINGLE_AXIS_CTRL OmronLib\ServoPress\Single- Instance of the SingleAxisCtrl
AxisCtrl (Single-axis Control) function
block
PrgTable ARRAY[1..50] OF Omron- Program table
Lib\ServoPress\sPRG_TABLE
PrgLoadAlarm OmronLib\ServoPress\sPRG_- Program load alarm conditions
LOAD_ALARM
Lock1 BOOL Starts Servo ON.
Pwr_Status BOOL Servo ON state
Hm_D BOOL Ends homing.
StartPg BOOL Starts single-axis program opera-
tion.
SingleAxisPrgOpr_Abt BOOL Abort trigger for single-axis pro-
gram operation
SingleAxisPrgOpr_Start- USINT Start step number
StepNo
SingleAxisCtrl_D BOOL Ends single-axis control execu-
tion.
SingleAxisCtrl_SingleCmd- USINT Single-axis command profile num-
ProfileNo ber
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation
busy
SingleAxisPrgOpr_Err BOOL Single-axis program operation
fault
MCCmdExec ARRAY[0..9] OF BOOL Motion function block execution
trigger
SingleCmdProfile OmronLib\ServoPress\sSIN- Single-axis command profile
GLE_CMD_PROFILE
StepCompleted BOOL Ends step.
StepExec BOOL Starts step.
CurrentStepNo USINT Current step number
MV_ex BOOL Execution trigger for interrupt
motion operation
Load LREAL Load measurement value
TorqueVal LREAL Load-to-torque conversion value
MechaPrm OmronLib\Servo- Servo press actuator machine
Press\sMECHA_PARAMS parameters
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
_EC_PDSlavTbl ARRAY[1..192] OF BOOL --- Communications enabled status
_EC_CommErrTbl ARRAY[1..192] OF BOOL --- Communications error status
Algorithm
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PWR MC_Power Instance of the MC_Power (Power
Servo) instruction
HM MC_Home Instance of the MC_Home (Home)
instruction
SET_TRQ_LMT MC_SetTorqueLimit Instance of the MC_SetTorqueLimit
(Set Torque Limit) instruction
MV MC_Move Instance of the MC_Move (Position-
ing) instruction
STP MC_Stop Instance of the MC_Stop (Stop)
instruction
SINGLE_AXIS_PRG_OPR OmronLib\ServoPress\SP_S- Instance of the SP_SingleAxisPr-
ingleAxisPrgOpr gOpr (Single-axis Program Opera-
tion) function block
SINGLE_AXIS_CTRL OmronLib\ServoPress\Single- Instance of the SingleAxisCtrl (Sin-
AxisCtrl gle-axis Control) function block
PrgTable ARRAY[1..50] OF Omron- Program table
Lib\Servo-
Press\sPRG_TABLE
PrgLoadAlarm OmronLib\Servo- Program load alarm conditions
Press\sPRG_LOAD_ALARM
Lock1 BOOL Starts Servo ON.
Pwr_Status BOOL Servo ON state
Hm_D BOOL Ends homing.
StartPg BOOL Starts single-axis program opera-
tion.
SingleAxisPrgOpr_Abt BOOL Abort trigger for single-axis pro-
gram operation
SingleAxisPrgOpr_Start- USINT Start step number
StepNo
SingleAxisCtrl_D BOOL Ends single-axis control execution.
SingleAxisCtrl_SingleCmd- USINT Single-axis command profile num-
ProfileNo ber
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation busy
SingleAxisPrgOpr_Err BOOL Single-axis program operation fault
MCCmdExec ARRAY[0..9] OF BOOL Motion function block execution trig-
ger
SingleCmdProfile OmronLib\ServoPress\sSIN- Single-axis command profile
GLE_CMD_PROFILE
StepCompleted BOOL Ends step.
StepExec BOOL Starts step.
CurrentStepNo USINT Current step number
MV_ex BOOL Execution trigger for interrupt motion
operation
Load LREAL Load measurement value
TorqueVal LREAL Load-to-torque conversion value
MechaPrm OmronLib\Servo- Servo press actuator machine
Press\sMECHA_PARAMS parameters
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
_EC_PDSlavTbl ARRAY[1..192] OF BOOL --- Communications enabled status
_EC_CommErrTbl ARRAY[1..192] OF BOOL --- Communications error status
Algorithm
//Start-up condition
IF (_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]=FALSE) THEN
Lock1:=TRUE;
ELSE
Lock1:=FALSE;
END_IF;
//Step No.1
PrgTable[1].StepCmdData.CtrlCode:=USINT#1;
PrgTable[1].StepCmdData.Position:=LREAL#50.0;
PrgTable[1].StepCmdData.Velocity:=LREAL#50.0;
PrgTable[1].StepCmdData.Acceleration:=LREAL#1000.0;
PrgTable[1].StepCmdData.Deceleration:=LREAL#1000.0;
PrgTable[1].StepCmdData.BufferMode:=_eMC_BUFFER_MODE#_mcAborting;
PrgTable[1].StepCmdData.TorqueLimitPositiveEnable:=BOOL#TRUE;
PrgTable[1].StepCmdData.TorqueLimitNegativeEnable:=BOOL#TRUE;
PrgTable[1].StepCmdData.TorqueLimitPositiveVal:=LREAL#20.0;
PrgTable[1].StepCmdData.TorqueLimitNegativeVal:=LREAL#20.0;
PrgTable[1].StepCmdData.ExtrOutputCode:=USINT#1;
PrgTable[1].StepCompleteData.CompleteType:=USINT#0;
//Step No.2
PrgTable[2].StepCmdData.CtrlCode:=USINT#1;
PrgTable[2].StepCmdData.Position:=LREAL#100.0;
PrgTable[2].StepCmdData.Velocity:=LREAL#100.0;
PrgTable[2].StepCmdData.Acceleration:=LREAL#1000.0;
PrgTable[2].StepCmdData.Deceleration:=LREAL#1000.0;
PrgTable[2].StepCmdData.BufferMode:=_eMC_BUFFER_MODE#_mcAborting;
PrgTable[2].StepCmdData.TorqueLimitPositiveEnable:=BOOL#FALSE;
PrgTable[2].StepCmdData.TorqueLimitNegativeEnable:=BOOL#FALSE;
PrgTable[2].StepCmdData.ExtrOutputCode:=USINT#2;
PrgTable[2].StepCompleteData.CompleteType:=USINT#0;
//Step No.3
PrgTable[3].StepCmdData.CtrlCode:=USINT#1;
PrgTable[3].StepCmdData.Position:=LREAL#200.0;
PrgTable[3].StepCmdData.Velocity:=LREAL#200.0;
PrgTable[3].StepCmdData.Acceleration:=LREAL#1000.0;
PrgTable[3].StepCmdData.Deceleration:=LREAL#1000.0;
PrgTable[3].StepCmdData.BufferMode:=_eMC_BUFFER_MODE#_mcAborting;
PrgTable[3].StepCmdData.TorqueLimitPositiveEnable:=BOOL#TRUE;
PrgTable[3].StepCmdData.TorqueLimitNegativeEnable:=BOOL#TRUE;
PrgTable[3].StepCmdData.TorqueLimitPositiveVal:=LREAL#50.0;
PrgTable[3].StepCmdData.TorqueLimitNegativeVal:=LREAL#50.0;
PrgTable[3].StepCmdData.ExtrOutputCode:=USINT#3;
PrgTable[3].StepCompleteData.CompleteType:=USINT#0;
//Mechanical parameters
MechaPrm.ReductionGearParam.Rn:=1;
MechaPrm.ReductionGearParam.Rd:=5;
MechaPrm.ReductionGearParam.n2:=0.9;
MechaPrm.BallScrewParam.n1:=0.95;
MechaPrm.BallScrewParam.R:=10.0;
MechaPrm.MotorRatedParam.Tr:=0.64;
TorqueVal:=\\OmronLib\ServoPress\LoadToTorque(
EN:=TRUE,
ENO=>LoadToTorque_Out,
Load:=Load,
MechaParams:=MechaPrm
);
//MC_Power
PWR(
Axis := MC_Axis000,
Enable := Lock1,
Status => Pwr_Status,
Busy => Pwr_Bsy,
Error => Pwr_Err,
ErrorID => Pwr_ErrID
);
//MC_Home
HM(
Axis := MC_Axis000,
Execute := UpTrig_Pwr_Status,
Done => Hm_D,
//SP_SingleAxisPrgOpr
SINGLE_AXIS_PRG_OPR(
PrgTable := PrgTable,
PrgLoadAlarm := PrgLoadAlarm,
Execute := SingleAxisPrgOpr_Ex,
Abort := SingleAxisPrgOpr_Abt,
StartStepNo := SingleAxisPrgOpr_StartStepNo,
SingleMode := SingleAxisPrgOpr_SingleMode,
Position := MC_Axis000.Act.Pos,
Velocity := MC_Axis000.Act.Vel,
Load := TorqueVal,
MCCmdDone := SingleAxisCtrl_D,
SingleCmdProfileNo := SingleAxisCtrl_SingleCmdProfileNo,
Done => SingleAxisPrgOpr_D,
MCCmdExec => MCCmdExec,
SingleCmdProfile => SingleCmdProfile,
CurrentStepNo => CurrentStepNo,
StepLoadAlarmOut => StepLoadAlarmOut,
PrgLoadAlarmOut => PrgLoadAlarmOut,
ExtrOutputCode => ExtrOutputCode,
StepExec => StepExec,
StepCompleted => StepCompleted,
Busy => SingleAxisPrgOpr_Bsy,
CommandAborted=> SingleAxisPrgOpr_Ca,
Error => SingleAxisPrgOpr_Err,
ErrorID => SingleAxisPrgOpr_ErrID,
ErrorIDEx => SingleAxisPrgOpr_ErrIDEx
);
//SingleAxisCtrl
SINGLE_AXIS_CTRL(
Axis := MC_Axis000,
SingleCmdProfile := SingleCmdProfile,
Execute := MCCmdExec[0],
MeasuringTorque:=TorqueVal,
VelOverrideEnable := SingleAxisCtrl_VelOvrEn,
InputVelFactor := SingleAxisCtrl_VelFactor,
ItgReset := BOOL#FALSE,
BufferMode := _eMC_BUFFER_MODE#_mcAborting,
Done => SingleAxisCtrl_D,
TargetReached => SingleAxisCtrl_TgtRch,
SingleCmdProfileNo => SingleAxisCtrl_SingleCmdProfileNo,
TorqueLimitParam => SingleAxisCtrl_TrqLmtPrm,
OverrideEnabled => SingleAxisCtrl_OvrEd,
Busy => SingleAxisCtrl_Bsy,
Active => SingleAxisCtrl_Act,
CommandAborted=> SingleAxisCtrl_Ca,
Error => SingleAxisCtrl_Err,
ErrorID => SingleAxisCtrl_ErrID,
ErrorIDEx => SingleAxisCtrl_ErrIDEx
);
//MC_SetTorqueLimit
SET_TRQ_LMT(
Axis:=MC_Axis000,
Enable:=SingleAxisPrgOpr_Bsy,
PositiveEnable := SingleAxisCtrl_TrqLmtPrm.TorqueLimitPositiveEnable,
PositiveValue := SingleAxisCtrl_TrqLmtPrm.TorqueLimitPositiveVal,
NegativeEnable := SingleAxisCtrl_TrqLmtPrm.TorqueLimitNegativeEnable,
NegativeValue := SingleAxisCtrl_TrqLmtPrm.TorqueLimitNegativeVal,
Enabled => SetTrqLmt_Ed,
Busy => SetTrqLmt_Bsy,
Error => SetTrqLmt_Err,
ErrorID => SetTrqLmt_ErrID
);
//MC_Stop
STP(
Axis := MC_Axis000,
Execute := (StopTrig1 OR StopTrig2),
Done => Stp_D,
Busy => Stp_Bsy,
Active => Stp_Act,
CommandAborted=> Stp_Ca,
Error => Stp_Err,
ErrorID => Stp_ErrID
);
SP_PrgStatusCtrl
The SP_PrgStatusCtrl function block interprets the program data and controls the next function block step by
step.
Function
FB/
block Name Graphic expression ST expression
FUN
name
SP_Prg Program FB SP_PrgStatusCtrl_instance (
StatusCtrl Status SP_PrgStatusCtrl_Instance PrgTable,
Control \\OmronLib\ServoPress\SP_PrgStatusCtrl Execute,
PrgTable PrgTable SingleStepMode,
StartStepNo,
Execute Done
Abort,
SingleStepMode MCCmdExec StepCompleted,
StepExit,
StartStepNo SingleCmdProfile
NextStepNo,
Abort StepExec Done,
MCCmdExec,
StepCompleted CurrentStepNo
SingleCmdProfile,
StepExit ExtrOutputCode StepExec,
CurrentStepNo,
NextStepNo Busy
ExtrOutputCode,
CommandAborted Busy,
CommandAborted,
Error Error,
ErrorID ErrorID,
ErrorIDEx);
ErrorIDEx
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00072
Publish/Do not publish source code Not published.
Function block and function version 1.00
Variables
Input Variables
Output Variables
Structure
The data type of the SingleCmdProfile output variable is the structure OmronLib\ServoPress\sSIN-
GLE_CMD_PROFILE. Refer to Structure in SP_SingleAxisPrgOpr on page 42 for details.
100 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgStatusCtrl
In-Out Variables
Structure
The data type of the PrgTable in-out variable is the structure OmronLib\ServoPress\sPRG_TABLE.
Refer to Structure in SP_SingleAxisPrgOpr on page 42 for details.
Function
The SP_PrgStatusCtrl function block interprets PrgTable (Program Tables) and controls the next func-
tion block for each step. The following function blocks can come next: SingleAxisCtrl (Single-axis Con-
trol), SP_StepCompleteJudge (Step Completion Determination), and SP_StepLoadAlarm (Step Load
Alarm Determination).
Sysmac Library User’s Manual for Servo Press Library (W573) 101
SP_PrgStatusCtrl
Execute SingleCmdProfile
StepExec
Busy
SP_StepCompleteJudge
Execute
SP_StepLoadAlarm
Execute
SP_PrgLoadAlarm
Enable
• The MCCmdExec[0] (Motion Function Block Execution Trigger) variable that is output from the
SP_PrgStatusCtrl function block is used as the Execute variable for the SingleAxisCtrl (Single-axis
Control) function block.
• The SingleCmdProfile (Single-axis Command Profile) variable that is output from the SP_PrgSta-
tusCtrl function block is used as the SingleCmdProfile (Single-axis Command Profile) variable for the
SingleAxisCtrl (Single-axis Control) function block.
• The StepExec (Step Start Trigger) variable that is output from the SP_PrgStatusCtrl function block is
used as the Execute variable for the SP_StepCompleteJudge (Step Completion Determination) func-
tion block and the SP_StepLoadAlarm (Step Load Alarm Determination) function block.
• The Busy (Executing) variable that is output from the SP_PrgStatusCtrl function block is used as the
Enable variable in the SP_PrgLoadAlarm (Program Load Alarm Determination) function block.
102 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgStatusCtrl
Meanings of Variables
The meanings of the other variables are described below.
Sysmac Library User’s Manual for Servo Press Library (W573) 103
SP_PrgStatusCtrl
Timing Charts
The following timing chart shows a case that the operation patterns shown in the sample programming
of the SP_SingleAxisPrgOpr (Single-axis Program Operation) function block are operated in this func-
tion block.
Normal End
• Busy (Executing) changes to TRUE when Execute in the function block changes to TRUE.
• The value of CurrentStepNo (Current Step Number) is updated whenever a step is completed.
• After execution of the step is completed, the value of CurrentStepNo (Current Step Number) is
retained until the value of Execute changes to TRUE again.
Execute TRUE
FALSE
TRUE
StepCompleted
FALSE
TRUE
Busy
FALSE
TRUE
Done
FALSE
StepExec TRUE
FALSE
MCCmdExec[0] TRUE
FALSE
CurrentStepNo 1 2 3 4
ExtrOutputCode 0 1 2 3 4
104 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgStatusCtrl
Aborting Execution
• When the value of Abort is changed to TRUE, the processing is aborted.
• Even after the step is aborted, the value of CommandAborted (Instruction Aborted) is retained
until the value of Execute changes to FALSE.
• CurentStepNo (Current Step Number) is retained until the value of Execute changes to TRUE
again.
• Abort is given priority over StepCompleted (Step Completed Trigger).
Execute TRUE
FALSE
TRUE
Abort
FALSE
TRUE
StepCompleted
FALSE
TRUE
Busy
FALSE
TRUE
Done
FALSE
TRUE
CommandAborted
FALSE
StepExec TRUE
FALSE
MCCmdExec[0] TRUE
FALSE
CurrentStepNo 1 2 3
ExtrOutputCode 0 1 2
Sysmac Library User’s Manual for Servo Press Library (W573) 105
SP_PrgStatusCtrl
Aborting Steps
• If the value of StepExit (Step Abort Trigger) changes to TRUE, the current step is aborted and the
step specified with NextStepNo (Next Step Number) is executed. The following shows a case that
a value of 8 is specified to NextStepNo.
• CurentStepNo (Current Step Number) is retained until the value of Execute changes to TRUE
again.
• If StepExit (Step Abort Trigger) and StepCompleted (Step Completed Trigger) change to TRUE at
the same, StepCompleted is given priority.
Execute TRUE
FALSE
TRUE
StepCompleted
FALSE
TRUE
StepExit
FALSE
NextStepNo 8
TRUE
Busy
FALSE
TRUE
Done
FALSE
TRUE
CommandAborted
FALSE
StepExec TRUE
FALSE
MCCmdExec[0] TRUE
FALSE
CurrentStepNo 1 2 3 8
ExtrOutputCode 0 1 2 3
106 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgStatusCtrl
Error End
The following timing chart gives an example when a control method outside the range is specified to
StepCmdData (Step Command Data) in the third step of PrgTable (Program Tables).
• If an error occurs during execution of this function block, Error changes to TRUE. You can find out
the cause of the error by referring to the values output by ErrorID (Error Code) and ErrorIDEx
(Expansion Error Code).
• If an error occurs, processing does not move to the next step.
• The value of Error is retained while the value of Execute is TRUE.
Execute TRUE
FALSE
TRUE
StepCompleted
FALSE
TRUE
Busy
FALSE
TRUE
Done
FALSE
TRUE
CommandAborted
FALSE
Error TRUE
FALSE
ErrorID 16#0000 16#3C4A
ErrorIDEx 16#0000 0000 16#0003 0003
StepExec TRUE
FALSE
MCCmdExec[0] TRUE
FALSE
CurrentStepNo 1 2
ExtrOutputCode 0 1 2
Sysmac Library User’s Manual for Servo Press Library (W573) 107
SP_PrgStatusCtrl
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections are given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3C4A 16#00000001 Execution start The value of StartStepNo (Exe- Check the valid range of the
step number cution Start Step Number) value of StartStepNo (Execution
range exceeded the valid range. Start Step Number) and set the
exceeded value within the valid range.
16#00000002 Next step num- The value of NextStepNo (Next Check the valid range of the
ber range Step Number) exceeded the value of NextStepNo (Next Step
exceeded valid range. Number) and set the value within
the valid range.
16#000003*1 Control method The value of CtrlCode (Control Check the valid range of the
range Method) is outside the valid value of CtrlCode (Control
exceeded range. Method) and set the value within
the valid range.
16#00000004 Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
*1. The boxes () are the BCD values of CurrentStepNo (Current Step Number) when the error occurred. For example, if
CurrentStepNo is USINT#11, ErrorIDEx is DWORD#16#00110003.
Sample Programming
Single-axis program operation is implemented by combining the SP_PrgStatusCtrl (Program Status
Control) function block, the SP_StepCompleteJudge (Step Completion Determination) function block,
the SP_StepLoadAlarm (Step Load Alarm Determination) function block, and the SP_PrgLoadAlarm
(Program Load Alarm Determination) function block.
This sample programming shows only the portion that executes single-axis program operation. It also
shows only the minimum rungs required for operation of the sample programming shown for the SP_S-
ingleAxisPrgOpr (Single-axis Program Operation) function block. Add other rungs as necessary, such
as stop rungs when a determination is made.
Refer to the descriptions of the ladder diagram and structured text program for the replacement method
to apply this sample programming to the SP_SingleAxisPrgOpr (Single-axis Program Operation) func-
tion block sample programming.
108 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgStatusCtrl
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Processing
Change the StartPG variable to TRUE after home has been defined to start single-axis program opera-
tion.
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
SP_PrgStatusCtrl_instance OmronLib\ServoPress\SP_Prg- Instance of the SP_PrgStatusCtrl
StatusCtrl (Program Status Control) func-
tion block
SP_StepComplete- OmronLib\ServoPress\SP_Step- Instance of the SP_StepCom-
Judge_instance CompleteJudge pleteJudge (Step Completion
Determination) function block
SP_StepLoadAlarm_in- OmronLib\ServoPress\SP_Step- Instance of the SP_StepLoadA-
stance LoadAlarm larm (Step Load Alarm Determi-
nation) function block
SP_PrgLoadAlarm_in- OmronLib\ServoPress\SP_Pr- Instance of the SP_PrgLoadA-
stance gLoadAlarm larm (Program Load Alarm
Determination) function block
PrgTable ARRAY[1..50] OF Omron- Program table
Lib\ServoPress\sPRG_TABLE
PrgLoadAlarm OmronLib\ServoPress\sPRG_- Program load alarm conditions
LOAD_ALARM
StartPg BOOL Starts single-axis program oper-
ation.
SingleAxisPrgOpr_Abt BOOL Abort trigger for single-axis pro-
gram operation
SingleAxisPrgOpr_Start- USINT Start step number
StepNo
SingleAxisCtrl_D BOOL Ends single-axis control execu-
tion.
SingleAxisCtrl_SingleCmd- USINT Single-axis command profile
ProfileNo number
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation
busy
SingleAxisPrgOpr_Err BOOL Single-axis program operation
fault
MCCmdExec ARRAY[0..9] OF BOOL Motion function block execution
trigger
SingleCmdProfile OmronLib\ServoPress\sSIN- Single-axis command profile
GLE_CMD_PROFILE
StepCompleted BOOL Ends step.
StepExec BOOL Starts step.
CurrentStepNo USINT Current step number
Sysmac Library User’s Manual for Servo Press Library (W573) 109
SP_PrgStatusCtrl
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
Algorithm
The algorithm can be used in the same manner as in the SP_SingleAxisPrgOpr (Single-axis Pro-
gram Operation) function block sample programming by replacing the sixth rung of that sample pro-
gramming (SP_SingleAxisPrgOpr (Single-axis Program Operation) function block instance) with the
following ladder programming.
110 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgStatusCtrl
Sysmac Library User’s Manual for Servo Press Library (W573) 111
SP_PrgStatusCtrl
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
SP_PrgStatusCtrl_instance OmronLib\ServoPress\SP_Prg- Instance of the SP_PrgStatusCtrl
StatusCtrl (Program Status Control) function
block
SP_StepComplete- OmronLib\ServoPress\SP_Step- Instance of the SP_StepCom-
Judge_instance CompleteJudge pleteJudge (Step Completion
Determination) function block
SP_StepLoadAlarm_in- OmronLib\ServoPress\SP_Step- Instance of the SP_StepLoadA-
stance LoadAlarm larm (Step Load Alarm Determina-
tion) function block
SP_PrgLoadAlarm_in- OmronLib\ServoPress\SP_Pr- Instance of the SP_PrgLoadAlarm
stance gLoadAlarm (Program Load Alarm Determina-
tion) function block
PrgTable ARRAY[1..50] OF Omron- Program table
Lib\ServoPress\sPRG_TABLE
PrgLoadAlarm OmronLib\ServoPress\sPRG_- Program load alarm conditions
LOAD_ALARM
StartPg BOOL Starts single-axis program opera-
tion.
SingleAxisPrgOpr_Abt BOOL Abort trigger for single-axis pro-
gram operation
SingleAxisPrgOpr_Start- USINT Start step number
StepNo
SingleAxisCtrl_D BOOL Ends single-axis control execu-
tion.
SingleAxisCtrl_SingleCmd- USINT Single-axis command profile num-
ProfileNo ber
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation
busy
SingleAxisPrgOpr_Err BOOL Single-axis program operation
fault
MCCmdExec ARRAY[0..9] OF BOOL Motion function block execution
trigger
SingleCmdProfile OmronLib\ServoPress\sSIN- Single-axis command profile
GLE_CMD_PROFILE
StepCompleted BOOL Ends step.
StepExec BOOL Starts step.
CurrentStepNo USINT Current step number
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
112 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgStatusCtrl
Algorithm
//Start trigger
inst2_R_TRIG( Clk := StartPg, Q => UpTrig_StartPg );
//Error stop
IF PrgStatusCtrl_Err OR StepCompleteJudge_Err OR StepLoadAlarm_Err OR PrgLoadA-
larm_Err THEN
SingleAxisPrgOpr_Err:=TRUE;
ErrorStop:=TRUE;
ELSE
SingleAxisPrgOpr_Err:=FALSE;
ErrorStop:=FALSE;
END_IF;
//SP_PrgOprCtrl
SP_PrgStatusCtrl_instance(
PrgTable := PrgTable,
Execute := SingleAxisPrgOpr_Ex,
SingleStepMode := SingleAxisPrgOpr_SingleMode,
StartStepNo := SingleAxisPrgOpr_StartStepNo,
Abort := Abort_SingleAxisPrgOpr,
StepCompleted := StepCompleted,
NextStepNo := NextStepNo,
Done => PrgStatusCtrl_Done,
MCCmdExec => MCCmdExec,
SingleCmdProfile => SingleCmdProfile,
StepExec => StepExec,
CurrentStepNo => CurrentStepNo,
Busy => SingleAxisPrgOpr_Bsy,
Error => PrgStatusCtrl_Err
);
//SP_StepCompleteJudge
SP_StepCompleteJudge_instance(
PrgTable := PrgTable,
Execute := StepExec,
CurrentStepNo := CurrentStepNo,
Abort := Abort_SingleAxisPrgOpr,
Position := MC_Axis000.Act.Pos,
Velocity := MC_Axis000.Act.Vel,
Load := TorqueVal,
MCCmdDone := SingleAxisCtrl_D,
SingleCmdProfileNo := SingleAxisCtrl_SingleCmdProfileNo,
Done => StepCompleted,
NextStepNo => NextStepNo,
Error => StepCompleteJudge_Err
);
//SP_StepLoadAlarm
SP_StepLoadAlarm_instance(
PrgTable := PrgTable,
Execute := StepExec,
CurrentStepNo := CurrentStepNo,
StepCompleted := StepCompleted,
Abort := Abort_SingleAxisPrgOpr,
Position := MC_Axis000.Act.Pos,
Sysmac Library User’s Manual for Servo Press Library (W573) 113
SP_PrgStatusCtrl
Load := TorqueVal,
Error => StepLoadAlarm_Err
);
//SP_PrgLoadAlarm
SP_PrgLoadAlarm_instance(
PrgLoadAlarm := PrgLoadAlarm,
Enable := SingleAxisPrgOpr_Bsy,
Position := MC_Axis000.Act.Pos,
Load := TorqueVal,
Error => PrgLoadAlarm_Err
);
//SP_SingleAxisPrgOpr
SINGLE_AXIS_PRG_OPR(
PrgTable := PrgTable,
PrgLoadAlarm := PrgLoadAlarm,
Execute := SingleAxisPrgOpr_Ex,
Abort := SingleAxisPrgOpr_Abt,
StartStepNo := SingleAxisPrgOpr_StartStepNo,
SingleMode := SingleAxisPrgOpr_SingleMode,
Position := MC_Axis000.Act.Pos,
Velocity := MC_Axis000.Act.Vel,
Load := TorqueVal,
MCCmdDone := SingleAxisCtrl_D,
SingleCmdProfileNo := SingleAxisCtrl_SingleCmdProfileNo,
Done => SingleAxisPrgOpr_D,
MCCmdExec => MCCmdExec,
SingleCmdProfile => SingleCmdProfile,
CurrentStepNo => CurrentStepNo,
StepLoadAlarmOut => StepLoadAlarmOut,
PrgLoadAlarmOut => PrgLoadAlarmOut,
ExtrOutputCode => ExtrOutputCode,
StepExec => StepExec,
StepCompleted => StepCompleted,
Busy => SingleAxisPrgOpr_Bsy,
CommandAborted=> SingleAxisPrgOpr_Ca,
Error => SingleAxisPrgOpr_Err,
ErrorID => SingleAxisPrgOpr_ErrID,
ErrorIDEx => SingleAxisPrgOpr_ErrIDEx
);
The same operations can be executed in this sample programming as those in the SP_SingleAxis-
PrgOpr (Single-axis Program Operation) function block sample programming by replacing the above
code. The following part in this sample programming is included in the SP_SingleAxisPrgOpr (Sin-
gle-axis Program Operation) function block sample programming. If you make the replacement, use
the part after the comment of //Error stop.
//Start trigger
inst2_R_TRIG( Clk := StartPg, Q => UpTrig_StartPg );
114 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepCompleteJudge
SP_StepCompleteJudge
The SP_StepCompleteJudge function block performs step completion determination based on the step com-
pletion conditions.
Function
FB/
block Name Graphic expression ST expression
FUN
name
SP_Step Step FB SP_StepCompleteJudge_instance (
Complete Comple- SP_StepCompleteJudge_Instance PrgTable,
Judge tion \\OmronLib\ServoPress\SP_StepCompleteJudge Execute,
PrgTable PrgTable
Determi- CurrentStepNo,
nation Execute Done Abort,
Position,
CurrentStepNo TimeOut Velocity,
Abort Unachieved Load,
MCCmdDone,
Position NextStepNo StepCompleteCode,
Velocity MonitorEnabled SingleCmdProfileNo,
Done,
Load Busy TimeOut,
CommandAborted Unachieved,
MCCmdDone
NextStepNo,
StepCompleteCode Error MonitorEnabled,
ErrorID
Busy,
SingleCmdProfileNo
CommandAborted,
ErrorIDEx Error,
ErrorID,
ErrorIDEx);
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function 00073
number
Publish/Do not publish Do not publish
source code
Function block and function 1.00
version
Sysmac Library User’s Manual for Servo Press Library (W573) 115
SP_StepCompleteJudge
Variables
Input Variables
116 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepCompleteJudge
Output Variables
Sysmac Library User’s Manual for Servo Press Library (W573) 117
SP_StepCompleteJudge
In-Out Variables
Structure
The data type of the PrgTable in-out variable is the structure OmronLib\ServoPress\sPRG_TABLE.
Refer to Structure in SP_SingleAxisPrgOpr on page 42 for details.
118 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepCompleteJudge
Function
This function block determines whether a step is completed based on the step completion conditions
that are set in PrgTable (Program Tables).
This function block provides the single-axis program operation in combination with the SP_PrgStatusC-
trl (Program Status Control), SP_StepLoadAlarm (Step Load Alarm Determination), and SP_PrgLoadA-
larm (Program Load Alarm Determination) function blocks. Refer to Relation with Other Function Blocks
on page 102 in the description of the SP_PrgStatusCtrl (Program Status Control) function block on rela-
tion with these function blocks.
Meanings of Variables
The meanings of the other variables are described below.
Sysmac Library User’s Manual for Servo Press Library (W573) 119
SP_StepCompleteJudge
120 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepCompleteJudge
Timing Charts
Normal End
• Busy (Executing) changes to TRUE when Execute in the function block changes to TRUE.
• If the step completion condition is met, the value of Done changes to TRUE and execution of this
function block is ended.
Time
Execute TRUE
FALSE
TimeOut TRUE
FALSE
Unachived TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
Sysmac Library User’s Manual for Servo Press Library (W573) 121
SP_StepCompleteJudge
Timeout Occurrence
• If a timeout occurs, the value of TimeOut (Timeout Occurrence) changes to TRUE and execution
of this function block is ended.
• The value of NextStepNo (Next Step Number) is retained even after a timeout occurs until the
value of Execute changes to TRUE.
• Even if a timeout occurs, an error will not occur.
StepCompleteData.TimeOut Time
Execute TRUE
FALSE
TimeOut TRUE
FALSE
NextStepNo 16#0 Next step number
Unachived TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
Error TRUE
FALSE
ErrorID 16#0000
ErrorIDEx 16#0000 0000
122 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepCompleteJudge
Step Incompletion
• If the value of Position (Current Position) is between MonitorMinPos (Minimum Monitoring Posi-
tion) and MonitorMaxPos (Maximum Monitoring Position), the value of MonitorEnabled (Load
Monitoring) changes to TRUE.
• If the step is not completed, the value of Unachieved (Step Incompletion) changes to TRUE, and
the execution of this function block is ended.
• If both a timeout and step incompletion occur in the same task period, step incompletion takes pri-
ority.
• The value of NextStepNo (Next Step Number) is retained even after step incompletion occurs until
the value of Execute changes to TRUE.
• Even if step incompletion occurs, an error will not occur.
Position
MonitorMinPos MonitorMaxPos
Execute TRUE
FALSE
Unachieved TRUE
FALSE
NextStepNo 16#0 Next step number
MonitorEnabled TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
Error TRUE
FALSE
ErrorID 16#0000
ErrorIDEx 16#0000 0000
Aborting Execution
• When the value of Abort is changed to TRUE, the processing is aborted.
Execute TRUE
FALSE
TRUE
Abort
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
CommandAborted
FALSE
Sysmac Library User’s Manual for Servo Press Library (W573) 123
SP_StepCompleteJudge
Error End
• If an error occurs during execution of this function block, Error changes to TRUE. You can find out
the cause of the error by referring to the values output by ErrorID (Error Code) and ErrorIDEx
(Expansion Error Code).
• The value of Error is retained while the value of Execute is TRUE.
Execute TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
Error TRUE
FALSE
ErrorID 16#0000 ErrorID
ErrorIDEx 16#0000 0000 ErrorIDEx
124 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepCompleteJudge
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections are given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3C4B 16# 0001 *1 Step timeout The value of TimeOut (Step Tim- Check the valid range of the
time out of eout Time) is outside the valid value for TimeOut (Step Timeout
range range. Time) and set the value within
the valid range.
16# 0002 Step timeout The value of TimeOutNext- Check the valid range of the
*1 next step num- StepNo (Step Timeout Next Step value for TimeOutNextStepNo
ber out of range Number) is outside the valid (Step Timeout Next Step Num-
range. ber) and set the value within the
valid range.
16# 0003 Illegal monitor- The value of MonitorMinPos Set MonitorMinPos (Minimum
*1 ing position (Minimum Monitoring Position) is Monitoring Position) to a value
greater than the value of that is less than or equal to the
MonitorMaxPos (Maximum value of MonitorMaxPos (Maxi-
Monitoring Position). mum Monitoring Position).
16# 0004 Monitoring start The value of MonitorStartTime Check the valid range of the
*1 time out of (Monitoring Start Time) is out- value for MonitorStartTime (Mon-
range side the valid range. itoring Start Time) and set the
value within the valid range.
16# 0005 Monitoring end The value of MonitorEndTime Check the valid range of the
*1 time out of (Monitoring End Time) is out- value for MonitorEndTime (Moni-
range side the valid range. toring End Time) and set the
value within the valid range.
16# 0006 Illegal monitor- The value of MonitorStartTime Set MonitorStartTime (Monitoring
*1 ing time (Monitoring Start Time) is greater Start Time) to a value that is less
than the value of MonitorEnd- than or equal to the value of
Time (Monitoring End Time). MonitorEndTime (Monitoring End
Time).
Sysmac Library User’s Manual for Servo Press Library (W573) 125
SP_StepCompleteJudge
Expansion error
Error code Status Description Correction
code
16#3C4B 16# 0007 Number of con- The value of InflPointGradient- Check the valid range for the
*1 secutive posi- Count (Number of Consecutive value of InflPointGradientCount
tion load Position Load Gradients) is out- (Number of Consecutive Position
gradients out of side the valid range. Load Gradients) and set the
range value within the valid range.
16# 0008 Number of con- The value of LoadDecreaseC- Check the valid range for the
*1 secutive load ount (Number of Consecutive value of LoadDecreaseCount
decreases Load Decreases Threshold) is (Number of Consecutive Load
threshold out of outside the valid range. Decreases Threshold) and set
range the value within the valid range.
16# 0009 Number of con- The value of LoadIncreaseCount Check the valid range for the
*1 secutive load (Number of Consecutive Load value of LoadIncreaseCount
increases Increases Threshold) is outside (Number of Consecutive Load
threshold out of the valid range. Increases Threshold) and set the
range value within the valid range.
16# 000A Step number The value of UnachievedNext- Check the valid range of the
*1 when step not StepNo (Step Number When value for UnachievedNext-
completed Step Not Completed) is outside StepNo (Step Number When
the valid range. Step Not Completed) and set the
value within the valid range.
16# 000B Wait time out of The value of WaitTime (Wait Check the valid range of the
*1 range Time) is outside the valid range. value for WaitTime (Wait Time)
and set the value within the valid
range.
16# 000C Position load The value of InflPointGradient Check the valid range for the
*1 gradient out of (Position Load Gradient) is out- value of InflPointGradient (Posi-
range side the valid range. tion Load Gradient) and set the
value within the valid range.
16# 000D Step completion The value of CompleteType Check the valid range of the
*1 type out of (Step Completion Type) value for CompleteType (Step
range exceeded the valid range. Completion Type) and set the
value within the valid range.
16# 000E Positioning The value of InPosWidth (Posi- Check the valid range of the
*1 in-position width tioning In-position Width) is out- value for InPosWidth (Positioning
out of range side the valid range. In-position Width) and set the
value within the valid range.
16#0000000F Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
*1. The boxes () are the BCD values of CurrentStepNo (Current Step Number) when the error occurred. For example,
if CurrentStepNo is USINT#11, ErrorIDEx is DWORD#16#00110001.
Sample Programming
Refer to Sample Programming on page 108 in the description of the SP_PrgStatusCtrl (Program Status
Control) function block.
126 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepLoadAlarm
SP_StepLoadAlarm
The SP_StepLoadAlarm function block performs step load alarm determination based on the step load alarm
conditions.
Function
FB/
block Name Graphic expression ST expression
FUN
name
SP_Step Step FB SP_StepLoadAlarm_instance (
Load Load SP_StepLoadAlarm_Instance PrgTable,
Alarm Alarm \\OmronLib\ServoPress\SP_StepLoadAlarm Execute,
PrgTable PrgTable
Determi- CurrentStepNo,
nation Execute Done StepCompleted,
Abort,
CurrentStepNo StepLoadAlarmOut Position,
StepCompleted MonitorEnabled Load,
Done,
Abort Busy StepLoadAlarmOut,
Position CommandAborted MonitorEnabled,
Busy,
Load Error CommandAborted,
ErrorID Error,
ErrorID,
ErrorIDEx ErrorIDEx);
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00074
Publish/Do not publish source code Do not publish
Function block and function version 1.00
Sysmac Library User’s Manual for Servo Press Library (W573) 127
SP_StepLoadAlarm
Variables
Input Variables
128 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepLoadAlarm
Output Variables
In-Out Variables
Structure
The data type of the PrgTable in-out variable is the structure OmronLib\ServoPress\sPRG_TABLE.
Refer to Structure in SP_SingleAxisPrgOpr on page 42 for details.
Sysmac Library User’s Manual for Servo Press Library (W573) 129
SP_StepLoadAlarm
Function
This function performs step load alarm determination based on the step load alarm conditions that are
set in PrgTable (Program Tables).
This function block provides the single-axis program operation in combination with the SP_PrgStatusC-
trl (Program Status Control), SP_StepCompleteJudge (Step Completion Determination), and SP_Pr-
gLoadAlarm (Program Load Alarm Determination) function blocks. Refer to Relation with Other
Function Blocks on page 102 in the description of the P_PrgStatusCtrl (Program Status Control) func-
tion block on relation with these function blocks.
Meanings of Variables
The meanings of the other variables are described below.
130 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepLoadAlarm
Timing Charts
Normal End for Determination While Step Is in Progress
• Busy (Executing) changes to TRUE when Execute in the function block changes to TRUE.
• The value of StepLoadAlarmOut (Step Load Alarm) changes to TRUE if the step load alarm condi-
tion is met.
• If the value of Position (Current Position) is between MonitorMinPos (Minimum Monitoring Posi-
tion) and MonitorMaxPos (Maximum Monitoring Position), the value of MonitorEnabled (Load
Monitoring) changes to TRUE.
• Step load alarm determination ends when the value of StepCompleted (Step Completed Trigger)
changes to TRUE. The value of StepLoadAlarmOut (Step Load Alarm) changes to FALSE.
MonitorMaxLoad
MonitorMinLoad
Current position
Execute TRUE
FALSE
StepCompleted TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
MonitorEnabled
FALSE
TRUE
StepLoadAlarmOut
FALSE
Sysmac Library User’s Manual for Servo Press Library (W573) 131
SP_StepLoadAlarm
MonitorMinLoad
Current position
Execute TRUE
FALSE
StepCompleted TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
StepLoadAlarmOut
FALSE
132 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_StepLoadAlarm
Aborting Execution
• When the value of Abort is changed to TRUE, the processing is aborted.
• The value of StepLoadAlarmOut (Step Load Alarm) changes to FALSE if execution is aborted.
Step started.
Load value MonitorMinPos MonitorMaxPos
MonitorMaxLoad
MonitorMinLoad
Current position
Execute TRUE
FALSE
Abort TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
StepLoadAlarmOut
FALSE
CommandAborted TRUE
FALSE
Error End
• If an error occurs during execution of this function block, Error changes to TRUE. You can find out
the cause of the error by referring to the values output by ErrorID (Error Code) and ErrorIDEx
(Expansion Error Code).
• The value of Error is retained while the value of Execute is TRUE.
Execute TRUE
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
Error TRUE
FALSE
ErrorID 16#0000 ErrorID
ErrorIDEx 16#0000 0000 ErrorIDEx
Sysmac Library User’s Manual for Servo Press Library (W573) 133
SP_StepLoadAlarm
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections are given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3C4C 16# 0001 *1 Illegal monitor- The value of MonitorMinPos Set MonitorMinPos (Monitoring
ing position (Monitoring Range Minimum Range Minimum Position) to a
Position) is greater than the value that is less than or equal to
value of MonitorMaxPos the value of MonitorMaxPos
(Monitoring Range Maximum (Monitoring Range Maximum
Position). Position).
16# 0002 Illegal monitor- The value of MonitorMinLoad Set MonitorMinLoad (Monitoring
*1 ing load (Monitoring Load Range Lower Load Range Lower Limit) to a
Limit) is greater than the value of value that is less than or equal to
MonitorMaxLoad (Monitoring the value of MonitorMaxLoad
Load Range Upper Limit). (Monitoring Load Range Upper
Limit).
16# 0003 Step load alarm The value of StepAlarmType Check the valid range of the
*1 determination (Step Load Alarm Determination value for StepAlarmType (Step
type out of Type) is outside the valid range. Load Alarm Determination Type)
range and set the value within the valid
range.
16# 0004 Upper/lower The value of InPosWidth Check the valid range of the
*1 monitoring limit (Upper/Lower Monitoring Limit value for InPosWidth
in-position width In-position Width) is outside the (Upper/Lower Monitoring Limit
out of range valid range. In-position Width) and set the
value within the valid range.
16#00000005 Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
*1. The boxes () are the BCD values of CurrentStepNo (Current Step Number) when the error occurred. For example,
if CurrentStepNo is USINT#11, ErrorIDEx is DWORD#16#00110001.
Sample Programming
Refer to Sample Programming on page 108 in the description of the SP_PrgStatusCtrl (Program Status
Control) function block.
134 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgLoadAlarm
SP_PrgLoadAlarm
The SP_PrgLoadAlarm function block performs program load alarm determination based on the program load
alarm conditions.
Function
FB/
block Name Graphic expression ST expression
FUN
name
SP_Prg Program FB SP_PrgLoadAlarm_instance (
Load Load SP_PrgLoadAlarm_Instance PrgLoadAlarm,
Alarm Alarm \\OmronLib\ServoPress\SP_PrgLoadAlarm Enable,
PrgLoadAlarm PrgLoadAlarm
Determi- Position,
nation Enable Enabled Load,
Enabled,
Position PrgLoadAlarmOut PrgLoadAlarmOut,
Load MonitorEnabled MonitorEnabled,
Busy,
Busy Error,
Error ErrorID,
ErrorIDEx);
ErrorID
ErrorIDEx
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00075
Publish/Do not publish source code Do not publish
Function block and function version 1.00
Sysmac Library User’s Manual for Servo Press Library (W573) 135
SP_PrgLoadAlarm
Variables
Input Variables
Output Variables
136 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgLoadAlarm
In-Out Variables
Structure
The data type of the PrgLoadAlarm in-out variable is the structure OmronLib\ServoPress\sPRG_-
LOAD_ALARM.
Refer to Structure in SP_SingleAxisPrgOpr on page 42 for details.
Sysmac Library User’s Manual for Servo Press Library (W573) 137
SP_PrgLoadAlarm
Function
This function block performs program load alarm determination based on PrgLoadAlarm (Program
Load Alarm Conditions).
This function block provides the single-axis program operation in combination with the SP_PrgStatusC-
trl (Program Status Control), SP_StepCompleteJudge (Step Completion Determination), and SP_Pr-
gLoadAlarm (Program Load Alarm Determination) function blocks. Refer to Relation with Other
Function Blocks on page 102 in the description of the SP_PrgStatusCtrl (Program Status Control) func-
tion block on relation with these function blocks.
Meanings of Variables
The meanings of the other variables are described below.
138 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgLoadAlarm
Timing Charts
Normal End
• Busy (Executing) changes to TRUE when Enable in the function block changes to TRUE.
• If the program load alarm condition is met, the value of PrgLoadAlarmOut (Program Load Alarm)
changes to TRUE.
• If the program load alarm condition is not met, the value of PrgLoadAlarmOut (Program Load
Alarm) changes to FALSE.
• When the value of Enable changes to FALSE, the value of PrgLoadAlarmOut (Program Load
Alarm) changes to FALSE.
LoadMaxLimit
LoadMinLimit
Current position
Enable TRUE
FALSE
Enabled TRUE
FALSE
TRUE
Busy
FALSE
TRUE
MonitorEnabled
FALSE
TRUE
PrgLoadAlarmOut
FALSE
Error End
• If an error occurs during execution of this function block, Error changes to TRUE. You can find out
the cause of the error by referring to the values output by ErrorID (Error Code) and ErrorIDEx
(Expansion Error Code).
• The value of Error is retained while the value of Enable is TRUE.
Enable TRUE
FALSE
TRUE
Enabled
FALSE
TRUE
Busy
FALSE
Error TRUE
FALSE
ErrorID 16#0000 ErrorID
ErrorIDEx 16#0000 0000 ErrorIDEx
Sysmac Library User’s Manual for Servo Press Library (W573) 139
SP_PrgLoadAlarm
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections are given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3C4D 16#00000001 Program load The value of PrgAlarmType Check the valid range of the
alarm (Program Load Alarm Determi- value for PrgAlarmType (Pro-
determination nation Type) is outside the valid gram Load Alarm Determination
type out of range. Type) and set the value within
range the valid range.
16#00000002 Standard type The value of UnitType (Standard Check the valid range of the
out of range Type) is outside of the valid value for UnitType (Standard
range. Type) and set the value within
the valid range.
16#00000003 Trapezoid area The value of Check the valid range of the
data alarm type TrapezoidData.AlarmType value for TrapezoidData.Alarm-
out of range (Alarm Type) is outside of the Type (Alarm Type) and set the
valid range. value within the valid range.
16#00000004 Trapezoid area The value of Check the valid range of the
data monitoring TrapezoidData.MonitorLowerTim value for TrapezoidData.Monitor-
lower limit e (Monitoring Lower Limit LowerTime (Monitoring Lower
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#00000005 Trapezoid area The value of Check the valid range of the
data monitoring TrapezoidData.MonitorUpperTim value for TrapezoidData.Moni-
upper limit e (Monitoring Upper Limit torUpperTime (Monitoring Upper
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#00000006 Illegal trape- The value of Set TrapezoidData.MonitorLow-
zoid area data TrapezoidData.MonitorLowerTim erTime (Monitoring Lower Limit
monitoring e (Monitoring Lower Limit Elapsed Time) to a value that is
lower limit Elapsed Time) is greater than less than or equal to the value of
elapsed time the value of TrapezoidData.MonitorUpper-
TrapezoidData.MonitorUpperTim Time (Monitoring Upper Limit
e (Monitoring Upper Limit Elapsed Time).
Elapsed Time).
16#00000007 Illegal trape- The value of Set TrapezoidData.MonitorLow-
zoid area data TrapezoidData.MonitorLowerPo erPos (Minimum Monitoring
monitoring posi- s (Minimum Monitoring Position) Position) to a value that is less
tion is greater than the value of than or equal to the value of
TrapezoidData.MonitorUpperPo TrapezoidData.MonitorUpper-
s (Maximum Monitoring Pos (Maximum Monitoring Posi-
Position). tion).
140 Sysmac Library User’s Manual for Servo Press Library (W573)
SP_PrgLoadAlarm
Expansion error
Error code Status Description Correction
code
16#3C4D 16#00000008 Illegal trape- The value of Set the value of Trapezoid-
zoid area data TrapezoidData.LoadMinLower Data.LoadMinLower (Monitoring
monitoring start (Monitoring Start Point Minimum Start Point Minimum Load) to a
point load Load) is greater than the value value that is less than or equal to
of the value of TrapezoidData.Load-
TrapezoidData.LoadMaxLower MaxLower (Monitoring Start
(Monitoring Start Point Maximum Point Maximum Load).
Load).
16#00000009 Illegal trape- The value of Set the value of Trapezoid-
zoid area data TrapezoidData.LoadMinUpper Data.LoadMinUpper (Monitoring
monitoring end (Monitoring End Point Minimum End Point Minimum Load) to a
point load Load) is greater than the value value that is less than or equal to
of the value of TrapezoidData.Load-
TrapezoidData.LoadMaxUpper MaxUpper (Monitoring End Point
(Monitoring End Point Maximum Maximum Load).
Load).
16#0000000A Rectangle area The value of Check the valid range of the
data alarm type RectangleData.AlarmType value for RectangleData.Alarm-
out of range (Alarm Type) is outside of the Type (Alarm Type) and set the
valid range. value within the valid range.
16#0000000B Rectangle area The value of Check the valid range of the
data monitoring RectangleData.MonitorLowerTi value for RectangleData.Monitor-
lower limit me (Monitoring Lower Limit LowerTime (Monitoring Lower
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#0000000C Rectangle area The value of Check the valid range of the
data monitoring RectangleData.MonitorUpperTi value for RectangleData.Moni-
upper limit me (Monitoring Upper Limit torUpperTime (Monitoring Upper
elapsed time Elapsed Time) is outside of the Limit Elapsed Time) and set the
out of range valid range. value within the valid range.
16#0000000D Illegal rectan- The value of Set RectangleData.MonitorLow-
gle area data RectangleData.MonitorLowerTi erTime (Monitoring Lower Limit
monitoring me (Monitoring Lower Limit Elapsed Time) to a value that is
lower limit Elapsed Time) is greater than less than or equal to the value of
elapsed time the value of RectangleData.MonitorUpper-
RectangleData.MonitorUpperTi Time (Monitoring Upper Limit
me (Monitoring Upper Limit Elapsed Time).
Elapsed Time).
16#0000000E Illegal rectan- The value of Set RectangleData.MonitorLow-
gle area data RectangleData.MonitorLowerPo erPos (Minimum Monitoring
monitoring posi- s (Minimum Monitoring Position) Position) to a value that is less
tion is greater than the value of than or equal to the value of
RectangleData.MonitorUpperPo RectangleData.MonitorUpper-
s (Maximum Monitoring Pos (Maximum Monitoring Posi-
Position). tion).
Sysmac Library User’s Manual for Servo Press Library (W573) 141
SP_PrgLoadAlarm
Expansion error
Error code Status Description Correction
code
16#3C4D 16#0000000F Illegal rectan- The value of Set the value of Rectangle-
gle area data RectangleData.LoadMinLimit Data.LoadMinLimit (Load Lower
load (Load Lower Limit) is greater Limit) to a value that is less than
than the value of or equal to the value of Rectan-
RectangleData.LoadMaxLimit gleData.LoadMaxLimit (Load
(Load Upper Limit). Upper Limit).
16#00000010 Illegal trape- The positional relationships Set the values of
zoid area data between the values of TrapezoidData.MonitorLowerTim
TrapezoidData.MonitorLowerTim e (Monitoring Lower Limit
e (Monitoring Lower Limit Elapsed Time),
Elapsed Time), TrapezoidData.MonitorUpperTim
TrapezoidData.MonitorUpperTim e (Monitoring Upper Limit
e (Monitoring Upper Limit Elapsed Time),
Elapsed Time), TrapezoidData.MonitorLowerPos
TrapezoidData.MonitorLowerPo (Minimum Monitoring Position),
s (Minimum Monitoring TrapezoidData.MonitorUpperPos
Position), (Maximum Monitoring Position),
TrapezoidData.MonitorUpperPo TrapezoidData.LoadMinLower
s (Maximum Monitoring (Monitoring Start Point Minimum
Position), Load),
TrapezoidData.LoadMinLower TrapezoidData.LoadMaxLower
(Monitoring Start Point Minimum (Monitoring Start Point Maximum
Load), Load),
TrapezoidData.LoadMaxLower TrapezoidData.LoadMinUpper
(Monitoring Start Point Maximum (Monitoring End Point Minimum
Load), Load), and
TrapezoidData.LoadMinUpper TrapezoidData.LoadMaxUpper
(Monitoring End Point Minimum (Monitoring End Point Maximum
Load), and Load) so that the enclosed area
TrapezoidData.LoadMaxUpper is a trapezoid.
(Monitoring End Point Maximum
Load) do not form a trapezoid.
16#00000011 Upper/lower The value of InPosWidth Check the valid range of the
monitoring limit (Upper/Lower Monitoring Limit value for InPosWidth
in-position width In-position Width) is outside the (Upper/Lower Monitoring Limit
out of range valid range. In-position Width) and set the
value within the valid range.
16#00000012 Incorrect task An attempt was made to execute Execute this function block in a
setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
Sample Programming
Refer to Sample Programming on page 108 in the description of the SP_PrgStatusCtrl (Program Status
Control) function block.
142 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
SingleAxisCtrl
The SingleAxisCtrl function block executes position control, velocity control, torque control, and torque feed-
back control.
Function
FB/
block Name Graphic expression ST expression
FUN
name
SingleAx- Sin- FB SingleAxisCtrl_instance (
isCtrl gle-axis SingleAxisCtrl_Instance Axis,
\\OmronLib\ServoPress\SingleAxisCtrl
Control SingleCmdProfile,
Axis Axis
Execute,
SingleCmdProfile SingleCmdProfile MeasuringTorque,
VelOverrideEnable,
Execute Done InputVelFactor,
MeasuringTorque TargetReached ItgReset,
BufferMode,
VelOverrideEnable SingleCmdProfileNo Done,
InputVelFactor TorqueLimitParam TargetReached,
SingleCmdProfileNo,
ItgReset OverrideEnabled TorqueLimitParam,
BufferMode Busy
OverrideEnabled,
Busy,
Active Active,
CommandAborted
CommandAborted,
Error,
Error ErrorID,
ErrorIDEx);
ErrorID
ErrorIDEx
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00076
Publish/Do not publish source code Do not publish
Function block and function version 1.00
Sysmac Library User’s Manual for Servo Press Library (W573) 143
SingleAxisCtrl
Variables
Input Variables
Output Variables
144 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Sysmac Library User’s Manual for Servo Press Library (W573) 145
SingleAxisCtrl
Structure
The data type of the TorqueLimitParam output variable is the structure OmronLib\Servo-
Press\sTORQUE_LIMIT_PARAM. The specifications are as follows:
146 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Sysmac Library User’s Manual for Servo Press Library (W573) 147
SingleAxisCtrl
In-Out Variables
Structure
The data type of the SingleCmdProfile in-out variable is the structure OmronLib\ServoPress\sSIN-
GLE_CMD_PROFILE. Refer to Structure in SP_SingleAxisPrgOpr on page 42 for details.
For information on member valid ranges for SingleCmdProfile, refer to Valid Ranges of SingleCmd-
Profile (Single-axis Command Profile) Members on page 67.
148 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Function
You can set the parameters in SingleCmdProfile (Single-axis Command Profile) and execute this func-
tion block to execute position control, velocity control, torque control, and torque feedback control.
The next motion control instruction or motion control function is executed in this function block depend-
ing on the value of CtrlCode (Control Method).
When CtrlCode is set to USINT#1 (absolute positioning) or USINT#2 (relative positioning), you can use
Blending Mode to continuously execute up to 10 function blocks without stopping.
The next member of SingleCmdProfile (Single-axis Command Profile) is output in the same task period
as TorqueLimitParam (Torque Limit Settings). If you input these members to the MC_SetTorqueLimit
(Set Torque Limit) instruction and use the torque control function of the Servo Drive, the output torque
of the Servo Drive will be limited.
• TorqueLimitPositiveEnable (Enable Positive Torque Limit)
• TorqueLimitNegativeEnable (Enable Negative Torque Limit)
• TorqueLimitPositiveVal (Positive Torque Limit)
• TorqueLimitNegativeVal (Negative Torque Limit)
Sysmac Library User’s Manual for Servo Press Library (W573) 149
SingleAxisCtrl
Meanings of Variables
The meanings of the other variables are described below.
150 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Sysmac Library User’s Manual for Servo Press Library (W573) 151
SingleAxisCtrl
Other Specifications
This section describes other specifications.
Value of Ctrl-
Control method Object data mapping
Code
0 Deceleration stop *1
1 Absolute positioning *1
2 Relative positioning *1
152 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Timing Charts
Normal End of Single-axis Control
The timing chart when you use this function block for single-axis control depends of the value of Ctrl-
Code (Control Method). For details, refer to the manual for instructions for each control method.
Velocity
Time
Execute TRUE
FALSE
Busy TRUE
FALSE
Done TRUE
FALSE
CommandAborted TRUE
FALSE
SingleCmdProfileNo 0 1 2 3 0
Sysmac Library User’s Manual for Servo Press Library (W573) 153
SingleAxisCtrl
Current
torque
Time
Torque measured
with an external sensor
Execute TRUE
FALSE
SingleCmdProfile.
SingleCmdData[1].CtrlCode 1 3 4 5
Busy TRUE
FALSE
Active TRUE
FALSE
Done TRUE
FALSE
CommandAborted TRUE
FALSE
Error TRUE
FALSE
154 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Error End
If an error occurs during function block execution, Error will change to TRUE and the axis will stop.
You can find out the cause of the error by referring to the values output by ErrorID (Error Code) and
ErrorIDEx (Expansion Error Code).
TRUE
Execute
FALSE
TRUE
Busy
FALSE
TRUE
Active
FALSE
TRUE
CommandAborted
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 ErrorID
ErrorIDEx 16#0000 ErrorIDEx
Value of
Re-exe-
Ctrl- Control method Restrictions*1
cution
Code
When you re-execute the function block, the value of
0 Deceleration stop Yes Deceleration (Deceleration Set Value) changes.
The value of Jerk (Jerk Set Value) does not change.
You can change the following input variables when you
re-execute the function block: Position (Position Set
1 Absolute positioning Yes Value), Velocity (Velocity Set Value), Accerelation (Accel-
eration Set Value), and Deceleration (Deceleration Set
Value).
You can change the following input variables when you
re-execute the function block: Position (Position Set
2 Relative positioning Yes Value), Velocity (Velocity Set Value), Accerelation (Accel-
eration Set Value), and Deceleration (Deceleration Set
Value).
Yes A Motion Control Instruction Re-execution Disabled event
3 CSV mode velocity control
(error code: 543B hex) will occur.
You can change the following input variables when you
re-execute the function block: Velocity (Velocity Set
4 Torque control Yes
Value), Accerelation (Acceleration Set Value), and
Deceleration (Deceleration Set Value).
Any of the input variables can be changed when you
5 Torque feedback control Yes
re-execute the function block.
*1. For details on restrictions, refer to the manual for instructions for each control method.
Sysmac Library User’s Manual for Servo Press Library (W573) 155
SingleAxisCtrl
This function block alternatingly and internally performs multi-execution of two MC_TorqueControl
(Torque Control) instructions each task period. Therefore, in a user program that executes an
MC_Move (Positioning) instruction before this function block, as in the following figure, if multi-execu-
tion of the MC_Move (Positioning) instruction is performed during execution of this function block, the
MC_TorqueControl (Torque Control) instruction that is executed later aborts execution of the MC_Move
(Positioning) instruction.
Execute A MC_Move_instance
MC_Move
SingleAxisCtrl_instance
Execute B
SingleAxisCtrl
MC_TorqueControl_instance2
MC_TorqueControl
156 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
MC_Move Instruction
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
Active
FALSE
CommandAborted TRUE
FALSE
SingleAxisCtrlFB
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
Active
FALSE
CommandAborted TRUE
FALSE
On the other hand, in a user program that executes an MC_Move (Positioning) instruction after this
function block, the MC_Move (Positioning) instruction is not aborted because multi-execution of the
MC_Move (Positioning) instruction is performed after execution of the MC_TorqueControl (Torque
Control) instruction in this function block.
SingleAxisCtrl_instance
Execute A SingleAxisCtrl
MC_TorqueControl_instance2
MC_TorqueControl
Execute B MC_Move_instance
MC_Move
Sysmac Library User’s Manual for Servo Press Library (W573) 157
SingleAxisCtrl
SingleAxisCtrlFB
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
Active
FALSE
CommandAborted TRUE
FALSE
MC_Move Instruction
Execute TRUE
FALSE
TRUE
Busy
FALSE
TRUE
Active
FALSE
CommandAborted TRUE
FALSE
158 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Variables To Use
The following table gives the variables in SingleCmdProfile (Single-axis Command Profile) that are
used for the CSV mode velocity control function.
Sysmac Library User’s Manual for Servo Press Library (W573) 159
SingleAxisCtrl
Timing Charts
Normal End
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Con-
trolling) changes to TRUE in the next task period.
• TargetReached (Target Reached) changes to TRUE when the command velocity in this function
block reaches Velocity (Velocity Set Value).
• If another instruction aborts execution of this function block, CommandAborted changes to TRUE
and Busy (Executing), Active (Controlling), and TargetReached (Target Reached) change to
FALSE.
• The MC_Stop instruction is used to stop execution of this function block.
SingleAxisCtrl FB
Execute TRUE
FALSE
TRUE
TargetReached
FALSE
TRUE
Busy
FALSE
TRUE
Active
FALSE
1 task period
CommandAborted TRUE
FALSE
Velocity
Time
MC_Stop Instruction
Execute TRUE
FALSE
Done TRUE
FALSE
Busy TRUE
FALSE
Active TRUE
FALSE
160 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Velocity
Velocity
Time
Execution of other instruction
Sysmac Library User’s Manual for Servo Press Library (W573) 161
SingleAxisCtrl
Command
Torque torque
PID Servo Drive M
MeasuringTorque calculation
Generated
force
In this function, torque feedback control is implemented by inputting the command torque calculated to
the Torque (Target torque) input variable of the MC_TorqueControl (Torque Control) instruction.
For details on the MC_TorqueControl (Torque Control) instruction, refer to the motion control instruc-
tions reference manual.
162 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Variables To Use
The following table gives the variables in SingleCmdProfile (Single-axis Command Profile) that are
used for the torque feedback control function.
Meanings of Variables
The meanings of the variable are described below.
Sysmac Library User’s Manual for Servo Press Library (W573) 163
SingleAxisCtrl
Torque
Torque
TorqueRamp
MeasuringTorque
Time
Other Specifications
This section describes other specifications.
Command Current Position and Actual Current Position during Torque Feed-
back Control
The following current positions are given in the system-defined variables for motion control during
torque feedback control for this function block.
164 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Home Status
Home remains defined.
Software Limits
The software limits are applied.
They are applied even if one of the following is selected in the axis parameter: Deceleration stopping
enabled for command position or Immediate stopping enabled for command position (stop using
remaining pulses).
Sysmac Library User’s Manual for Servo Press Library (W573) 165
SingleAxisCtrl
166 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Timing Charts
Normal end
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Con-
trolling) changes to TRUE in the next task period.
• When the difference between Torque (Torque Set Value) and MeasuringTorque (Measured
Torque) becomes equal to or less than the value of InTorqueWidth (In Torque Width), Target-
Reached (Target Reached) changes to TRUE.
• If another instruction aborts this function, CommandAborted changes to TRUE and Busy (Execut-
ing), Active (Controlling), and TargetReached (Target Reached) change to FALSE.
• The MC_Stop instruction is used to stop execution of this function block.
Execute
TargetReached
Busy
CommandAborted
Velocity
Axis current velocity
Time
Torque feedback control Position control
Torque
Command Torque
Torque Torque control for the velocity limit
of the Servo Drive
MeasuringTorque
Time
Sysmac Library User’s Manual for Servo Press Library (W573) 167
SingleAxisCtrl
Execute
Done
Busy
Active
CommandAborted
SingleAxisCtrlFB
Execute
TargetReached
Busy
Active
CommandAborted
Velocity
Time
Position control Torque feedback control
Torque MeasuringTorque
Command torque
Torque
Time
168 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Additional Information
The MC Function Module sends a command to the Servo Drive to change the Control Mode with the
timing shown in the timing chart. The timing of implementing the Control Mode change in the Servo
Drive depends on Servo Drive specifications.
Sysmac Library User’s Manual for Servo Press Library (W573) 169
SingleAxisCtrl
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections are given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3C0A 16#00000005 Torque feed- The value of Kp (Proportional Check the valid range of the
back control Gain) is outside the valid range. value of Kp (Proportional Gain)
proportional and set the value within the valid
gain value out range.
of valid range
16#00000006 Torque feed- The value of Ki (Integral Gain) is Check the valid range of the
back control outside the valid range. value of Ki (Integral Gain) and set
integral gain the value within the valid range.
value out of
valid range
16#00000007 Torque feed- The value of Kd (Derivative Check the valid range of the
back control Gain) is outside the valid range. value of Kd (Derivative Gain) and
derivative gain set the value within the valid
value out of range.
valid range
16#00000008 Torque feed- • The relationship of the values • Correct the relationship so that
back control of the TorqueLowLmt and Tor- TorqueUpLmt (Torque Upper
output limit queUpLmt input variables to Limit) is equal to or greater
value out of this function block does not than TorqueLowLmt (Torque
valid range meet the required condition. Lower Limit).
• Nonnumeric data is input for • Set TorqueUpLmt (Torque
TorqueUpLmt (Torque Upper Upper Limit) and TorqueLow-
Limit) or TorqueLowLmt Lmt (Torque Lower Limit) to
(Torque Lower Limit). correct real numbers.
16#0000000A Torque feed- The value of InTorqueWidth (In Check the valid range of the
back control Torque Width) is outside the value of InTorqueWidth (In
in-torque value valid range. Torque Width) and set the value
out of valid within the valid range.
range
16#3C4E 16#00000001 Axis error An axis error occurred. *1
detected
16#00000002 Buffer mode The value of BufferMode (Buffer Check the valid range of the
selection out of Mode Selection) is outside the value of BufferMode (Buffer
range valid range. Mode Selection) and set the
value within the valid range.
16#000001*2 Illegal control The value of SingleCmdPro- Correct the value of SingleCmd-
method file[].CtrlCode (Control Profile[].CtrlCode (Control
Method) is incorrect. Method).
170 Sysmac Library User’s Manual for Servo Press Library (W573)
SingleAxisCtrl
Expansion error
Error code Status Description Correction
code
16#3C4F 16#00000001 Buffer mode The value of BufferMode (Buffer Check the valid range of the
selection out of Mode Selection) is outside the value of BufferMode (Buffer
range valid range. Mode Selection) and set the
value within the valid range.
16#00000002 Axis error An axis error occurred. *1
detected
16#00000003 Velocity set The value of Velocity (Velocity Check the valid range of the
value out of Set Value) is outside the valid value of Velocity (Velocity Set
range range. Value) and set the value within
the valid range.
16#00000004 Acceleration The value of Acceleration Check the valid range of the
rate set value (Acceleration Rate Set Value) is value of Acceleration (Accelera-
out of range outside the valid range. tion Rate Set Value) and set the
value within the valid range.
16#00000005 Deceleration The value of Deceleration Check the valid range of the
rate set value (Deceleration Rate Set Value) is value of Deceleration (Decelera-
out of range outside the valid range. tion Rate Set Value) and set the
value within the valid range.
16#3C5D 16#00000001 Buffer mode The value of BufferMode (Buffer Check the valid range of the
selection out of Mode Selection) is outside the value of BufferMode (Buffer
range valid range. Mode Selection) and set the
value within the valid range.
16#00000002 Axis error An axis error occurred. *1
detected.
16#00000003 Torque set The value of Torque (Torque Set Check the valid range of the
value out of Value) is outside the valid range. value of Torque (Torque Set
range Value) and set the value within
the valid range.
16#00000004 Velocity set The value of Velocity (Velocity Check the valid range of the
value out of Set Value) is outside the valid value of Velocity (Velocity Set
range range. Value) and set the value within
the valid range.
16#00000005 Motion control An attempt was made to re-exe- Stop this function block and then
instruction cute a motion control instruction re-execute the motion control
re-execution that cannot be re-executed. instruction.
disabled
Sysmac Library User’s Manual for Servo Press Library (W573) 171
SingleAxisCtrl
Expansion error
Error code Status Description Correction
code
16#3C5E 16#00000001 Buffer mode The value of BufferMode (Buffer Check the valid range of the
selection out of Mode Selection) is outside the value of BufferMode (Buffer
range valid range. Mode Selection) and set the
value within the valid range.
16#00000002 Axis error An axis error occurred. *1
detected
16#00000003 Torque set The value of Torque (Torque Set Check the valid range of the
value out of Value) is outside the valid range. value of Torque (Torque Set
range Value) and set the value within
the valid range.
16#00000004 Measured The value of MeasuringTorque Check the valid range of the
torque out of (Measured Torque) is outside the value of MeasuringTorque (Mea-
range valid range. sured Torque) and set the value
within the valid range.
16#00000005 Torque ramp The value of TorqueRamp Check the valid range of the
set value out of (Torque Ramp Set Value) is out- value of TorqueRamp (Torque
range side the valid range. Ramp Set Value) and set the
value within the valid range.
16#00000006 Velocity set The value of Velocity (Velocity Check the valid range of the
value out of Set Value) is outside the valid value of Velocity (Velocity Set
range range. Value) and set the value within
the valid range.
*1. For details, refer to the motion control user’s manual.
*2. The boxes () are the array element number of SingleCmdProfile (Single-axis Command Profile).
Sample Programming
Refer to Sample Programming on page 87 in the description of the SP_SingleAxisPrgOpr (Single-axis
Program Operation) function block.
172 Sysmac Library User’s Manual for Servo Press Library (W573)
TorqueToLoad
TorqueToLoad
The TorqueToLoad function converts the measured torque into a load value.
MeasuringTorque Out
MechaParams
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00083
Publish/Do not publish source code Do not publish.
Function block and function version 1.00
Variables
Input Variables
Sysmac Library User’s Manual for Servo Press Library (W573) 173
TorqueToLoad
Structure
The data type of the MechaParams input variable is structure
OmronLib\ServoPress\sMECHA_PARAMS. The specifications are as follows:
Output Variables
174 Sysmac Library User’s Manual for Servo Press Library (W573)
TorqueToLoad
Function
This function converts MeasuringTorque (Measured Torque) of the motor to Out (Load Value) in a
direct-operation conversion mechanism that uses a motor, reducer, and ball screw, as shown in the fol-
lowing figure.
MeasuringTorque[%] Out[N]
Servomotor Reducer
2π × n1 × 1000 Rd MeasuringTorque[%]
Out[N] = × × n2 × Tr ×
R Rn 100
For example, if the values of the input variables are as follows, the value of Out (Load Value) is
859.539518431971.
Sample Programming
This sample programming converts the torque monitor value of the Servomotor (unit: percentage of
rated Servomotor torque) to the load for the servo press actuator mechanism (unit: newton).
Sysmac Library User’s Manual for Servo Press Library (W573) 175
TorqueToLoad
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Processing
The torque measurement value as a percentage of the rated Servomotor torque is converted to the
load in newtons according to the specified machine parameters.
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
TorqueVal LREAL Torque measurement value
Load LREAL Torque-to-load conversion value
MechaPrm OmronLib\Servo- Servo press actuator machine parame-
Press\sMECHA_PARAMS ters
Algorithm
176 Sysmac Library User’s Manual for Servo Press Library (W573)
TorqueToLoad
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
TorqueVal LREAL Torque measurement value
Load LREAL Torque-to-load conversion value
MechaPrm OmronLib\ServoPress\sMECHA_PARAMS Servo press actuator machine param-
eters
Algorithm
//Mechanical parameters
MechaPrm.ReductionGearParam.Rn:=1;
MechaPrm.ReductionGearParam.Rd:=5;
MechaPrm.ReductionGearParam.n2:=0.9;
MechaPrm.BallScrewParam.n1:=0.95;
MechaPrm.BallScrewParam.R:=10.0;
MechaPrm.MotorRatedParam.Tr:=0.64;
Load:=\\OmronLib\ServoPress\TorqueToLoad(
EN:=TRUE,
ENO=>TorqueToLoad_Out,
MeasuringTorque:=TorqueVal,
MechaParams:=MechaPrm
);
Sysmac Library User’s Manual for Servo Press Library (W573) 177
LoadToTorque
LoadToTorque
The TorqueToLoad function converts a load value into a torque.
Load Out
MechaParams
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00084
Publish/Do not publish source code Do not publish.
Function block and function version 1.00
Variables
Input Variables
Structure
The data type of the MechaParams input variable is structure
OmronLib\ServoPress\sMECHA_PARAMS. Refer to Structure in TorqueToLoad on P.174 for details.
178 Sysmac Library User’s Manual for Servo Press Library (W573)
LoadToTorque
Output Variables
Sysmac Library User’s Manual for Servo Press Library (W573) 179
LoadToTorque
Function
Load is converted to Out (Torque) for a press mechanism that uses a motor, reducer, and ball screw, as
shown in the following figure.
Load[N] Out[%]
Reducer Servomotor
This function is used when you execute torque feedback control using the SingleAxisCtrl (Single Axis
Control) function block. This function converts the load measured by a sensor to a motor torque as
shown in the following figure and sets this torque in the MeasuringTorque (Measured Torque) input vari-
able for the SingleAxisCtrl (Single Axis Control) function block.
MeasuringTorque
Measured load [N]
R Rn 100
Out[%] = Load[N] × × ×
2π × n1 × 1000 Rd n2 × Tr
For example, if the values of the input variables are as follows, the value of Out (Load Value) is
0.581706820079817.
180 Sysmac Library User’s Manual for Servo Press Library (W573)
LoadToTorque
Sample Programming
Refer to Sample Programming on page 87 in the description of the SP_SingleAxisPrgOpr (Single-axis
Program Operation) function block.
Sysmac Library User’s Manual for Servo Press Library (W573) 181
PrgOprRsltRec
PrgOprRsltRec
The PrgOprRsltRec function block records the results of single-axis program operation.
Function
FB/
block Name Graphic expression ST expression
FUN
name
PrgOpr Program FB PrgOprRsltRec_instance (
RsltRec Opera- PrgOprRsltRec_Instance Enable,
\\OmronLib\ServoPress\PrgOprRsltRec
tion StepExec,
Enable Enabled
Results StepCompleted,
Recorder StepExec Busy CurrentStepNo,
Position,
StepCompleted Error
Load,
CurrentStepNo ErrorID Enabled,
Busy,
Position ErrorIDEx
Error,
Load ErrorID,
ErrorIDEx,
PrgOprRsltRecorder PrgOprRsltRecorder PrgOprRsltRecorder);
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00080
Publish/Do not publish source code Published.
Function block and function version 1.00
182 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltRec
Variables
Input Variables
Output Variables
Sysmac Library User’s Manual for Servo Press Library (W573) 183
PrgOprRsltRec
In-Out Variables
Structure
The data type of the PrgOprRsltRecorder in-out variable is the structure
OmronLib\ServoPress\sPRG_OPR_RSLT_RECORDER. The specifications are as follows:
184 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltRec
Sysmac Library User’s Manual for Servo Press Library (W573) 185
PrgOprRsltRec
Function
In the operation of a single-axis program that uses the SP_SingleAxisPrgOpr (Single-Axis Program
Operation) function block, the results of execution of each step and the results of execution of the entire
single-axis program are recorded in PrgOprRsltRecorder (Program Operation Results Recorder).
186 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltRec
Meanings of Variables
The meanings of the other variables are described below.
Timing Charts
Normal End
• Enabled changes to TRUE at the same time as Enable in this function block changes to TRUE.
• While Enabled is TRUE, the value of StepRsltRec (Step Execution Results) is updated at each
step in single-axis program operation.
• The start and completion of each step are recognized when StepExec (Step Start Trigger) and
StepCompleted (Step Completed Trigger) change to TRUE.
• The execution results when Enable changes to TRUE and when Enable changes to FALSE are
recorded.
• The execution results when StepExec (Step Start Trigger) and StepCompleted (Step Completed
Trigger) change to TRUE are recorded.
Enable TRUE
FALSE
TRUE
StepExec
FALSE
TRUE
StepCompleted
FALSE
Enabled TRUE
FALSE
TRUE
Busy
FALSE
Sysmac Library User’s Manual for Servo Press Library (W573) 187
PrgOprRsltRec
Error End
• If an error occurs during execution of this function block, Error changes to TRUE. You can find out
the cause of the error by referring to the values output by ErrorID (Error Code) and ErrorIDEx
(Expansion Error Code).
• The execution results when an error occurs are not recorded. StepRsltRec (Step Execution
Results) is recorded for the last step that is completed before the error. In the following figure,
StepRsltRec (Step Execution Results) is recorded for step 1, but for step 2 and after, StepRsltRec
(Step Execution Results), PrgMaxPos (Program Operation Maximum Position), PrgLoadMaxPos
(Load at Program Operation Maximum Position), PrgMaxLoad (Program Operation Maximum
Load), and PrgPosMaxLoad (Position at Program Operation Maximum Load) are not recorded.
Enable TRUE
FALSE
TRUE
StepExec
FALSE
TRUE
StepCompleted
FALSE
Enabled TRUE
FALSE
TRUE
Busy
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 ErrorID
SP_SingleAxisPrgOpr
TRUE
Execute
FALSE
CurrentStepNo 1 2 3
Busy TRUE
FALSE
TRUE
Done
FALSE
PrgOprRsltRec
Enable TRUE
FALSE
TRUE
StepExec
FALSE
TRUE
StepCompleted
FALSE
188 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltRec
Additional Information
To save the contents of PrgOprRsltRecorder (Program Operation Results Recorder) to an SD Memory
Card in CSV format, use the PrgOprRsltCSVWrite function block on P.192.
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3C5F 16#00000001 Step Execution An attempt was made to record Check that the StepRsltRec (Step
Results Value step execution results that Execution Results) array is at
Error exceeded the size of the least as large as the number of
StepRsltRec (Step Execution steps in the single-axis program
Results) array. operation.
Sample Programming
This sample programming creates program operation result record data for SP_SingleAxisPrgOpr (Sin-
gle-axis Program Operation) function block sample programming execution results.
It is added and executed after the SP_SingleAxisPrgOpr (Single-axis Program Operation) function
block sample programming.
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Sysmac Library User’s Manual for Servo Press Library (W573) 189
PrgOprRsltRec
Processing
If PrgRsltRec_En (Enable Program Operation Result Recording) is TRUE and data was not saved to
the SD Memory Card with the PrgRsltCSVWrite (Program Operation Results SD Memory Card Write)
function block, this processing records the program operation results while the SP_SingleAxisPrgOpr
(Single-axis Program Operation) function block is being executed.
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PRG_RSLT_REC OmronLib\ServoPress\PrgO- Instance of the PrgOprRsltRec
prRsltRec (Program Operation Results
Recorder) function block
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation busy
PrgRsltRec_En BOOL Enables program operation result
recording.
PrgRsltCSVWrite_Bsy BOOL Saving data to memory card (Used
in the PrgOpsRsltCSVWrite (Pro-
gram Operation Results SD Mem-
ory Card Write) function block
sample programming.)
StepExec BOOL Ends step.
StepCompleted BOOL Starts step.
CurrentStepNo USINT Current step number
Prg_Rslt_Recorder OmronLib\Servo- Program operation result record
Press\sPRG_O- data
PR_RSLT_RECORDER
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
Algorithm
190 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltRec
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PRG_RSLT_REC OmronLib\ServoPress\PrgO- Instance of the PrgOprRsltRec
prRsltRec (Program Operation Results
Recorder) function block
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation busy
PrgRsltRec_En BOOL Enables program operation result
recording.
PrgRsltCSVWrite_Bsy BOOL Saving data to memory card (Used
in the PrgOpsRsltCSVWrite (Pro-
gram Operation Results SD Mem-
ory Card Write) function block
sample programming.)
StepExec BOOL Ends step.
StepCompleted BOOL Starts step.
CurrentStepNo USINT Current step number
Prg_Rslt_Recorder OmronLib\Servo- Program operation result record
Press\sPRG_O- data
PR_RSLT_RECORDER
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
Algorithm
//PrgOprRsltRec
//Start on PrgOprRsltCSVWrite not in progress.
PRG_RSLT_REC(
Enable := SingleAxisPrgOpr_Bsy AND PrgRsltRec_En AND NOT(PrgRsltCSVWrite_Bsy),
StepExec := StepExec,
StepCompleted := StepCompleted,
CurrentStepNo := CurrentStepNo,
Position := MC_Axis000.Act.Pos,
Load := MC_Axis000.Act.Trq,
Enabled => PrgRsltRec_Ed,
Busy => PrgRsltRec_Bsy,
Error => PrgRsltRec_Err,
ErrorID => PrgRsltRec_ErrID,
ErrorIDEx => PrgRsltRec_ErrIDEx,
PrgOprRsltRecorder := Prg_Rslt_Recorder
);
Sysmac Library User’s Manual for Servo Press Library (W573) 191
PrgOprRsltCSVWrite
PrgOprRsltCSVWrite
The PrgOprRsltCSVWrite function block writes the results of single-axis program operation to an SD Memory
Card in CSV format.
Function
FB/
block Name Graphic expression ST expression
FUN
name
PrgOpr Write FB PrgOprRsltCSVWrite_instance (
RsltCSV Program PrgOprRsltCSVWrite_Instance Execute,
\\OmronLib\ServoPress\PrgOprRsltCSVWrite
Write Opera- PrgOprRsltRecorder,
Execute Done
tion FileName,
Results PrgOprRsltRecorder PrgOprRsltRecorder Done,
to SD Busy,
FileName Busy
Memory Error,
Card Error ErrorID,
ErrorIDEx);
ErrorID
ErrorIDEx
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00081
Publish/Do not publish source code Published.
Function block and function version 1.00
Variables
Input Variables
192 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltCSVWrite
Output Variables
In-Out Variables
Structure
The data type of the PrgOprRsltRecorder in-out variable is the structure OmronLib\Servo-
Press\sPRG_OPR_RSLT_RECORDER. Refer to Structure in PrgOprRsltRec on P.182 for details.
Sysmac Library User’s Manual for Servo Press Library (W573) 193
PrgOprRsltCSVWrite
Function
This function block writes the PrgOprRsltRecorder (Program Operation Results Recorder) results of
single-axis program operation to an SD Memory Card in CSV format. The name of the file to write is
specified with FileName.
With FileName, you can specify the name including the folder. If the specified folder does not exist, an
error occurs. If the folder is not specified, create FileName in the root of the SD Memory Card.
'ExecDateTi ExecDateTim
me' e
'PrgMaxPos' PrgMaxPos
'PrgLoadMax PrgLoadMax
Pos' Pos
'PrgMaxLoad PrgMaxLoad
'
'PrgPosMaxL PrgPosMaxL
oad' oad
'StepRsltRec. 'StepRsltRec. 'StepRsltRec. 'StepRsltRec. 'StepRsltRec. 'StepRsltRec.
'StepRsltRec. 'StepRsltRec. 'StepRsltRec.
No' StartPos' EndPos' StartLoad' EndLoad' MaxPos' LoadMaxPos' MaxLoad' PosMaxLoad'
StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec
[0].No [0].StartPos [0].EndPos [0].StartLoad [0].EndLoad [0].MaxPos [0].LoadMax [0].MaxLoad [0].PosMaxL
Pos oad
StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec
[1].No [1].StartPos [1].EndPos [1].StartLoad [1].EndLoad [1].MaxPos [1].LoadMax [1].MaxLoad [1].PosMaxL
Pos oad
: : : : : : : : :
StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec StepRsltRec
[49].No [49].StartPos [49].EndPos [49].StartLoa [49].EndLoad [49].MaxPos [49].LoadMa [49].MaxLoa [49].PosMax
d xPos d Load
ExecDateTime (Record Date and Time) is converted to a text string and written with the DtToString
instruction. Refer to the instructions reference manual for details on the DtToString instruction.
Data other than ExecDateTime is converted to text strings and written with the LrealToFormatString
instruction. The total number of digits is set to eight and the fractional part is set to six digits. Refer to
the instructions reference manual for details on the LrealToFormatString instruction.
194 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltCSVWrite
Timing Charts
Normal End
• Busy (Executing) changes to TRUE when Execute changes to TRUE.
• Done changes to TRUE when the data output operation is completed.
TRUE
Execute
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 16#0000 16#0000 16#0000
Error End
• If an error occurs when execution of the function block is in progress, Error changes to TRUE and
Busy (Executing) changes to FALSE.
• You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
• If Execute changes to FALSE before execution of the function block is ended, Done and Error are
TRUE only for one task period after execution of the function block is ended.
• If Execute remains TRUE even after execution of the function block is ended, the output values of
Done and Error are held.
TRUE
Execute
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 ErrorID 16#0000 ErrorID
Additional Information
To store the results of single-axis program operation into PrgOprRsltRecorder (Program Operation
Results Recorder), use the PrgOprRsltRec function block on P.182.
Sysmac Library User’s Manual for Servo Press Library (W573) 195
PrgOprRsltCSVWrite
196 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltCSVWrite
Sysmac Library User’s Manual for Servo Press Library (W573) 197
PrgOprRsltCSVWrite
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#0000 0000 Normal end --- ---
16#0400 16#0000 0000 Input Value Out The file name specified with File- Set FileName correctly.
of Range Name contains one or more
characters that cannot be used.
16#0000 0000 The directory name specified Check the length of the text
with FileName is too long. strings specified with FileName
so that it is within the valid range.
16#1400 16#0000 0000 SD Memory An SD Memory Card is either Insert an SD Memory Card cor-
Card Access not inserted or is not inserted rectly.
Failure properly.
16#0000 0000 The SD Memory Card is broken. Replace the SD Memory Card
with one that operates normally.
16#0000 0000 The SD Memory Card slot is bro- If this error persists even after
ken. making the above two correc-
tions, replace the CPU Unit or the
Industrial PC.
16#1401 16#0000 0000 SD Memory An attempt was made to write to Remove write protection from the
Card Write-pro- a write-protected SD Memory SD Memory Card. Slide the small
tected Card. switch on the side of the SD
Memory Card from the LOCK
position to the writable position.
16#1402 16#0000 0000 SD Memory The SD Memory Card ran out of Replace the SD Memory Card for
Card Insuffi- free space. one with sufficient available
cient Capacity capacity.
16#1403 16#0000 0000 File Does Not The specified directory does not Specify an existing directory.
Exist exist.
16#1404 16#0000 0000 Too Many Files/ The maximum number of files or Check that the number of files or
Directories directories was exceeded when directories in the SD Memory
creating a file or directory for an Card does not exceed the maxi-
instruction. mum number.
16#1405 16#0000 0000 File Already in An instruction attempted to read Correct the user program so that
Use or write a file already being this function block is executed
accessed by another instruction. only when the Busy output vari-
able for all other instructions for
the same file is FALSE.
16#140A 16#0000 0000 Write Access The file or directory specified for Remove write protection from the
Denied the function block to write is file or directory specified for the
write-protected. function block. Or, change the file
name of the file to write.
16#140B 16#0000 0000 Too Many Files The maximum number of open Correct the user program to
Open files was exceeded when open- decrease the number of open
ing a file for the function block. files.
16#140D 16#0000 0000 File or Direc- The file name or directory name Check that the specified file
tory Name Is that was specified for an instruc- name or directory name does not
Too Long tion is too long. exceed the maximum length.
16#140E 16#0000 0000 SD Memory The SD Memory Card is broken. Replace the SD Memory Card.
16#0000 0000 Card Access The SD Memory Card slot is bro- If this error occurs even after
Failed ken. making the above correction,
replace the CPU Unit or the
Industrial PC.
198 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprRsltCSVWrite
Sample Programming
This sample programming saves the program operation result record data that was created with the
PrgOprRsltRec (Program Operation Result) function block sample programming to the SD Memory
Card inserted in the CPU Unit in CSV format.
It is added and executed after the SP_SingleAxisPrgOpr (Single-axis Program Operation) function
block and PrgOpsRsltRec (Program Operation Result) function block sample programming.
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Processing
This sample programming saves the program operation result data to the SD Memory Card with the
specified file name when PrgRsltCSVWrite_StartPg (SD Card Save Trigger for Program Operation
Result Data) changes to TRUE.
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PRG_RSLT_CSV_WRITE OmronLib\ServoPress\PrgO- Instance of the PrgO-
prRsltCSVWrite prRsltCSVWrite (Write Pro-
gram Operation Results to SD
Memory Card) function block
Prg_Rslt_Recorder OmronLib\ServoPress\sPRG_O- Program operation result
PR_RSLT_RECORDER record data
PrgRsltCSVWrite_StartPg BOOL SD card save trigger for pro-
gram operation result data
PrgRsltCSVWrite_FN STRING[66] File name
PrgRsltCSVWrite_Bsy BOOL Saving data to memory card
Sysmac Library User’s Manual for Servo Press Library (W573) 199
PrgOprRsltCSVWrite
Algorithm
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PRG_RSLT_CSV_WRITE OmronLib\ServoPress\PrgO- Instance of the PrgO-
prRsltCSVWrite prRsltCSVWrite (Write Pro-
gram Operation Results to SD
Memory Card) function block
Prg_Rslt_Recorder OmronLib\ServoPress\sPRG_O- Program operation result
PR_RSLT_RECORDER record data
PrgRsltCSVWrite_StartPg BOOL SD card save trigger for pro-
gram operation result data
PrgRsltCSVWrite_FN STRING[66] File name
PrgRsltCSVWrite_Bsy BOOL Saving data to memory card
Algorithm
//Specify the filename and start PrgRsltCSVWrite.
IF UpTrig_PrgRsltCSVWrite_StartPg=TRUE THEN
//Filename
PrgRsltCSVWrite_FN:='ProgramOperationResult.csv';
END_IF;
//PrgOprRsltCSVWrite
PRG_RSLT_CSV_WRITE(
Execute := UpTrig_PrgRsltCSVWrite_StartPg,
FileName := PrgRsltCSVWrite_FN,
PrgOprRsltRecorder := Prg_Rslt_Recorder,
Done => PrgRsltCSVWrite_D,
Busy => PrgRsltCSVWrite_Bsy,
Error => PrgRsltCSVWrite_Err,
ErrorID => PrgRsltCSVWrite_ErrID,
ErrorIDEx => PrgRsltCSVWrite_ErrIDEx
);
200 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTracePut
PrgOprTracePut
The PrgOprTracePut function adds trace data to the program operation trace recorder 10 at a time.
Function FB/
Name Graphic expression ST expression
name FUN
PrgOpr Add Pro- FUN Out:=PrgOprTracePut(
TracePut gram \\OmronLib\ServoPress\PrgOprTracePut PrgOprRecord,
EN Out
Operation PrgOprTraceRecorder);
Trace PrgOprRecord
Records
PrgOprTraceRecorder PrgOprTraceRecorder
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00082
Publish/Do not publish source code Published.
Function block and function version 1.00
Variables
Input Variables
Sysmac Library User’s Manual for Servo Press Library (W573) 201
PrgOprTracePut
Structure
The data type of the PrgOprRecord input variable is the structure OmronLib\ServoPress\sPRG_O-
PR_RECORD. The specifications are as follows:
Output Variables
In-Out Variables
202 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTracePut
Structure
The data type of the PrgOprTraceRecorder in-out variable is the structure OmronLib\Servo-
Press\sPRG_OPR_TRACE_RECORDER. The specifications are as follows:
Sysmac Library User’s Manual for Servo Press Library (W573) 203
PrgOprTracePut
Function
This function adds trace data to PrgOprTraceRecorder (Program Operation Trace Recorder) 10 at a
time. The 10 trace data records are stored beforehand in PrgOprRecord (Program Operation Trace
Records).
Top (First Trace Record) is the index to the first trace record stored in PrgOprTraceRecorder. Bottom
(Last Trace Record) is the index to the last trace record stored in PrgOprTraceRecorder. Count (Trace
Record Count) shows the number of trace records that are stored in PrgOprTraceRecorder.
For example, when 200 trace records are stored in PrgOprTraceRecorder, the values of the variables
are as shown in the following figure. The trace record that is stored in PrgOprTrcRecords[0] is
expressed as TR0 and the trace record that is stored in PrgOprTrcRecords[1] is expressed as TR1.
Count=UINT#200
Top=UINT#0 [0]=TR0
[1]=TR1
[198]=TR198
Bottom=UINT#199 [199]=TR199
[19998]=
[19999]=
If there are already 20,000 trace records stored in PrgOprTraceRecorder and another trace record is
added, the oldest trace record is overwritten. The values of the variables when the 20,001st trace
record is added are as shown in the following figure.
Count=UINT#20000 Count=UINT#20000
Added.
[19997]=TR19997 [19997]=TR19997
[19998]=TR19998 [19998]=TR19998
Bottom=UINT#19999 [19999]=TR19999 [19999]=TR19999
When Count = UINT#0, the values of Top and Bottom are both 0.
204 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTracePut
Additional Information
To save the contents of PrgOprTraceRecorder (Program Operation Trace Recorder) to an SD Memory
Card in CSV format, use the PrgOprTraceCSVWrite function block on P.208.
Sample Programming
This sample programming creates program operation trace data for the SP_SingleAxisPrgOpr (Sin-
gle-axis Program Operation) function block sample programming execution result. The trace data is
specified as the MC_Axis000.Act.Pos (Actual Current Position), MC_Axis000.Act.Vel (Actual Current
Velocity), and MC_Axis000.Act.Trq (Actual Current Torque) axis variables.
It is added and executed after the SP_SingleAxisPrgOpr (Single-axis Program Operation) function
block sample programming.
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Processing
If PrgTracePut_En (Enable Program Operation Trace Recording) is TRUE and data was not saved to
the SD Memory Card with the PrgTraceCSVWrite (Program Operation Trace Recorder SD Memory
Card Write) function block, this processing records a trace of the specified data while the SP_SingleAx-
isPrgOpr (Single-axis Program Operation) function block is being executed.
Sysmac Library User’s Manual for Servo Press Library (W573) 205
PrgOprTracePut
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation
busy
PrgTracePut_En BOOL Enables program operation
trace recording.
PrgTraceCSVWrite_Bsy BOOL Saving data to memory card
(Used in the PrgOp-
sTraceCSVWrite (Program
Operation Trace Recorder SD
Memory Card Write) function
block sample programming.)
Prg_Record OmronLib\ServoPress\sPRG_O- Program operation trace data
PR_RECORD (1 record)
Prg_Trace_Recorder OmronLib\ServoPress\sPRG_O- Program operation trace data
PR_TRACE_RECORDER
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
Algorithm
206 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTracePut
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation
busy
PrgTracePut_En BOOL Enables program operation
trace recording.
PrgTraceCSVWrite_Bsy BOOL Saving data to memory card
(Used in the PrgOp-
sTraceCSVWrite (Program
Operation Trace Recorder SD
Memory Card Write) function
block sample programming.)
Prg_Record OmronLib\ServoPress\sPRG_O- Program operation trace data
PR_RECORD (1 record)
Prg_Trace_Recorder OmronLib\ServoPress\sPRG_O- Program operation trace data
PR_TRACE_RECORDER
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
Algorithm
//Specify trace record.
IF SingleAxisPrgOpr_Bsy=TRUE THEN
Prg_Record.ExecDateTime:=GetTime();
Prg_Record.TraceData[0]:=MC_Axis000.Act.Pos;
Prg_Record.TraceData[1]:=MC_Axis000.Act.Vel;
Prg_Record.TraceData[2]:=MC_Axis000.Act.Trq;
END_IF;
//PrgOprTracePut
//Start on PrgOprTraceCSVWrite not in progress.
PrgTracePut_Out:=\\OmronLib\ServoPress\PrgOprTracePut(
EN := SingleAxisPrgOpr_Bsy AND PrgTracePut_En AND NOT(PrgTraceCSVWrite_Bsy),
PrgOprRecord := Prg_Record,
PrgOprTraceRecorder := Prg_Trace_Recorder
);
Sysmac Library User’s Manual for Servo Press Library (W573) 207
PrgOprTraceCSVWrite
PrgOprTraceCSVWrite
The PrgOprTraceCSVWrite function block writes the contents of the program operation trace recorder to an SD
Memory Card in CSV format.
Function
FB/
block Name Graphic expression ST expression
FUN
name
PrgOpr Write FB PrgOprTraceCSVWrite_instance (
TraceCSV from Pro- PrgOprTraceCSVWrite_Instance Execute,
\\OmronLib\ServoPress\PrgOprTraceCSVWrite
Write gram PrgOprTraceRecorder,
Execute Done
Opera- FileName,
tion Trace PrgOprTraceRecorder PrgOprTraceRecorder WriteLineNum,
Recorder Done,
FileName Busy
to SD Busy,
Memory WriteLineNum Error Error,
Card ErrorID,
ErrorID
ErrorIDEx);
ErrorIDEx
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00098
Publish/Do not publish source code Published.
Function block and function version 1.00
Variables
Input Variables
208 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTraceCSVWrite
Output Variables
In-Out Variables
Structure
The data type of the PrgOprTraceRecorder in-out variable is the structure OmronLib\Servo-
Press\sPRG_OPR_TRACE_RECORDER. Refer to Structure in PrgOprTracePut on P.201 for
details.
Sysmac Library User’s Manual for Servo Press Library (W573) 209
PrgOprTraceCSVWrite
Function
This function block writes all the contents of PrgOprTraceRecorder (Program Operation Trace
Recorder) to an SD Memory Card in CSV format. The name of the file to write is specified with File-
Name.
With FileName, you can specify the name including the folder. If the specified folder does not exist, an
error occurs. If the folder is not specified, create FileName in the root of the SD Memory Card.
Refer to Structure in PrgOprTracePut on page 1-201 for further details on the PrgOprTraceRecorder
structure.
: : :
ProgOprTrcRecords[19999]. ProgOprTrcRecords[19999]. ProgOprTrcRecords[19999].
ExecDateTime TraceData[0] TraceData[9]
ExecDateTime (Record Date and Time) is converted to a text string and written with the DtToString
instruction. Refer to the instructions reference manual for details on the DtToString instruction.
TraceData is converted to text strings and written with the LrealToFormatString instruction. The total
number of digits is set to eight and the fractional part is set to six digits. Refer to the instructions refer-
ence manual for details on the LrealToFormatString instruction.
210 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTraceCSVWrite
Timing Charts
Normal End
• Busy (Executing) changes to TRUE when Execute changes to TRUE.
• Done changes to TRUE when the data output operation is completed.
TRUE
Execute
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 16#0000 16#0000 16#0000
Error End
• If an error occurs when execution of the function block is in progress, Error changes to TRUE and
Busy (Executing) changes to FALSE.
• You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
• If Execute changes to FALSE before execution of the function block is ended, Done and Error are
TRUE only for one task period after execution of the function block is ended.
• If Execute remains TRUE even after execution of the function block is ended, the output values of
Done and Error are held.
TRUE
Execute
FALSE
TRUE
Done
FALSE
TRUE
Busy
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 ErrorID 16#0000 ErrorID
Additional Information
To add trace data to PrgOprTraceRecorder (Program Operation Trace Recorder), use the PrgOprTra-
cePut function block on P.201.
Sysmac Library User’s Manual for Servo Press Library (W573) 211
PrgOprTraceCSVWrite
212 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTraceCSVWrite
Sysmac Library User’s Manual for Servo Press Library (W573) 213
PrgOprTraceCSVWrite
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#0000 0000 Normal end --- ---
16#0400 16#0000 0000 Input Value Out The file name specified with File- Set FileName correctly.
of Range Name contains one or more
characters that cannot be used.
16#0000 0000 The directory name specified Check the length of the text
with FileName is too long. strings specified with FileName
so that it is within the valid range.
16#1400 16#0000 0000 SD Memory An SD Memory Card is either Insert an SD Memory Card cor-
Card Access not inserted or is not inserted rectly.
Failure properly.
16#0000 0000 The SD Memory Card is broken. Replace the SD Memory Card
with one that operates normally.
16#0000 0000 The SD Memory Card slot is bro- If this error persists even after
ken. making the above two correc-
tions, replace the CPU Unit or the
Industrial PC.
16#1401 16#0000 0000 SD Memory An attempt was made to write to Remove write protection from the
Card Write-pro- a write-protected SD Memory SD Memory Card. Slide the small
tected Card. switch on the side of the SD
Memory Card from the LOCK
position to the writable position.
16#1402 16#0000 0000 SD Memory The SD Memory Card ran out of Replace the SD Memory Card for
Card Insuffi- free space. one with sufficient available
cient Capacity capacity.
16#1403 16#0000 0000 File Does Not The specified directory does not Specify an existing directory.
Exist exist.
16#1404 16#0000 0000 Too Many The maximum number of files or Check that the number of files or
Files/Directo- directories was exceeded when directories in the SD Memory
ries creating a file or directory for an Card does not exceed the maxi-
instruction. mum number.
16#1405 16#0000 0000 File Already in An instruction attempted to read Correct the user program so that
Use or write a file already being this function block is executed
accessed by another instruction. only when the Busy output vari-
able for all other instructions for
the same file is FALSE.
16#140A 16#0000 0000 Write Access The file or directory specified for Remove write protection from the
Denied the function block to write is file or directory specified for the
write-protected. function block. Or, change the file
name of the file to write.
16#140B 16#0000 0000 Too Many Files The maximum number of open Correct the user program to
Open files was exceeded when open- decrease the number of open
ing a file for the function block. files.
16#140D 16#0000 0000 File or Direc- The file name or directory name Check that the specified file
tory Name Is that was specified for an instruc- name or directory name does not
Too Long tion is too long. exceed the maximum length.
16#140E 16#0000 0000 SD Memory The SD Memory Card is broken. Replace the SD Memory Card.
16#0000 0000 Card Access The SD Memory Card slot is bro- If this error occurs even after
Failed ken. making the above correction,
replace the CPU Unit or the
Industrial PC.
214 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTraceCSVWrite
Expansion error
Error code Status Description Correction
code
16#3CA5 16#00000001 First Data Posi- The value of Top (First Trace Set the value of Top (First Trace
tion Specifica- Record) is outside the valid Record) within the valid range for
tion Error range for the array. the array.
16#00000002 Last Data Posi- The value of Bottom (Last Trace Set the value of Bottom (Last
tion Specifica- Record) is outside the valid Trace Record) within the valid
tion Error range for the array. range for the array.
16#00000003 No Data Stored There are no program operation Make sure that program opera-
in Data trace records (Count = UINT#0) tion trace records are stored in
Recorder in PrgOprTraceRecorder (Pro- PrgOprTraceRecorder (Program
gram Operation Trace Operation Trace Recorder).
Recorder).
16#00000004 Data Recorder There is a conflict among the Check the values of Top (First
Storage Infor- values of Top (First Trace Trace Record), Bottom (Last
mation Error Record), Bottom (Last Trace Trace Record), and Count (Trace
Record), and Count (Trace Record Count).
Record Count).
16#00000005 Number of The value of WriteLineNum Check the valid range of the
Lines to Write (Number of Lines to Write) is value for WriteLineNum (Number
Out of Range outside the valid range. of Lines to Write) and set the
value within the valid range.
Sample Programming
This sample programming saves the program operation trace data that was created with the PrgOpr-
TracePut (Add Program Operation Trace Records) function sample programming to the SD Memory
Card inserted in the CPU Unit in CSV format.
It is added and executed after the SP_SingleAxisPrgOpr (Single-axis Program Operation) function
block and PrgOprTracePut (Add Program Operation Trace Records) function sample programming.
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Processing
The program operation trace data is saved to the SD Memory Card with the specified file name when
PrgTraceCSVWrite_StartPg (SD Card Save Trigger for Program Operation Trace Data) changes to
TRUE.
Sysmac Library User’s Manual for Servo Press Library (W573) 215
PrgOprTraceCSVWrite
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PRG_TRACE_CSV_WRITE OmronLib\ServoPress\PrgOpr- Instance of the PrgOpr-
TraceCSVWrite TraceCSVWrite (Write from
Program Operation Trace
Recorder to SD Memory
Card) function block
Prg_Trace_Recorder OmronLib\Servo- Program operation trace data
Press\sPRG_O-
PR_TRACE_RECORDER
PrgTraceCSVWrite_StartPg BOOL SD card save trigger for pro-
gram operation trace data
PrgTraceCSVWrite_FN STRING[66] File name
PrgTraceCSVWrite_Bsy BOOL Saving data to memory card
Algorithm
216 Sysmac Library User’s Manual for Servo Press Library (W573)
PrgOprTraceCSVWrite
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
PRG_TRACE_CSV_WRITE OmronLib\ServoPress\PrgOpr- Instance of the PrgOpr-
TraceCSVWrite TraceCSVWrite (Write from
Program Operation Trace
Recorder to SD Memory
Card) function block
Prg_Trace_Recorder OmronLib\Servo- Program operation trace data
Press\sPRG_O-
PR_TRACE_RECORDER
PrgTraceCSVWrite_StartPg BOOL SD card save trigger for pro-
gram operation trace data
PrgTraceCSVWrite_FN STRING[66] File name
PrgTraceCSVWrite_Bsy BOOL Saving data to memory card
Algorithm
//Specify the filename and start PrgTraceCSVWrite.
IF UpTrig_PrgTraceCSVWrite_StartPg=TRUE THEN
//Filename
PrgTraceCSVWrite_FN:='ProgramOperationTrace.csv';
END_IF;
//PrgOprTraceCSVWrite
PRG_TRACE_CSV_WRITE(
Execute := UpTrig_PrgTraceCSVWrite_StartPg,
FileName := PrgTraceCSVWrite_FN,
WriteLineNum := PrgTraceCSVWrite_WLineNum,
PrgOprTraceRecorder := Prg_Trace_Recorder,
Done => PrgTraceCSVWrite_D,
Busy => PrgTraceCSVWrite_Bsy,
Error => PrgTraceCSVWrite_Err,
ErrorID => PrgTraceCSVWrite_ErrID,
ErrorIDEx => PrgTraceCSVWrite_ErrIDEx
);
Sysmac Library User’s Manual for Servo Press Library (W573) 217
XYDataRec
XYDataRec
The XYDataRec function block traces two different input values and prepares trace data for displaying a broken
line graph on an NS/NA-series HMI.
Function
FB/
block Name Graphic expression ST expression
FUN
name
XYData Broken FB XYDataRec_instance (
Rec Line XYDataRec_Instance XYTraceData,
\\OmronLib\ServoPress\XYDataRec
Graph Enable,
XYTraceData XYTraceData
Trace X_Type,
Data Enable Enabled X,
Prepara- Y,
X_Type Busy
tion X_Orig,
X Error X_Width,
X_Direction,
Y ErrorID
Enabled,
X_Orig ErrorIDEx Busy,
Error,
X_Width ErrorID,
X_Direction
ErrorIDEx);
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00099
Publish/Do not publish source code Published.
Function block and function version 1.00
218 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataRec
Variables
Input Variables
Sysmac Library User’s Manual for Servo Press Library (W573) 219
XYDataRec
Output Variables
In-Out Variables
220 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataRec
Function
This function block prepares trace data for displaying a broken line graph on an NS/NA-series HMI from
X (X Input Value) and Y (Y Input Value).
X_Type=TRUE X_Type=FALSE
Y value Y value
Y value
XYTraceData[5]
XYTraceData[4]
XYTraceData[3]
XYTraceData[2]
XYTraceData[1]
XYTraceData[0]
X value
Sysmac Library User’s Manual for Servo Press Library (W573) 221
XYDataRec
For example, when X_Orig = LREAL#0.0, X_Width = LREAL#1.0, and X_Direction = TRUE, the X
values corresponding to the element numbers are as shown in the following table.
Therefore, the X values at the X axis scale positions on the graph are as shown in the following
graph.
Y value
XYTraceData[19999]
XYTraceData[2]
XYTraceData[1]
XYTraceData[0]
0.0 1.0 2.0 19999.0 X value
222 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataRec
These values and the Y values at the scale position on the X axis that are found by linearly interpo-
lating these values result in the following graph.
Y value
3.0
2.5
Input value
2.0
1.5 Value found by linear interpolation
1.0
0.5
As a result, the values of the XYTraceData array elements are as shown in the following table.
However, when a value conflicting with the X_Direction (X Increase/Decrease Direction) setting is
input as X (X Input Value), the Y (Y Input Value) input value in the same task period is ignored.
For example, assume that X_Orig = LREAL#0.0, X_Width = LREAL#1.0, and X_Direction = TRUE,
and that the following five sets of X (X Input Value) and Y (Y Input Value) have been input.
Sysmac Library User’s Manual for Servo Press Library (W573) 223
XYDataRec
The value of X (X Input Value) input in task period 4 is 2.5. This is less than the previous value of X
(X Input Value), which was 3.5. This conflicts with the setting X_Direction = TRUE. Therefore, the
value 2.0 that was input for Y (Y Input Value) in the same task period is ignored as shown in the fol-
lowing table.
Y value Ignored
3.0
2.5
Input value
2.0
1.5 Value found by linear interpolation
1.0
0.5
Y value
XYTraceData[5]
XYTraceData[4]
XYTraceData[3]
XYTraceData[2]
XYTraceData[1]
XYTraceData[0]
Elapsed time
Task period 1
Task period 2
Task period 3
Task period 4
Task period 5
Task period 6
Timing Charts
Normal End
• Busy (Executing) changes to TRUE at the same time as Enable in this function block changes to
TRUE.
• While the value of Enable is TRUE, X (X Input Value) and Y (Y Input Value) inputs are accepted.
TRUE
Enable
FALSE
TRUE
Enabled
FALSE
TRUE
Busy
FALSE
TRUE
Error
FALSE
ErrorID 16#0000
ErrorIDEx 16#00000000
224 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataRec
Error End
• If an error occurs during execution of this function block, Error changes to TRUE. You can find out
the cause of the error by referring to the values output by ErrorID (Error Code) and ErrorIDEx
(Expansion Error Code).
TRUE
Enable
FALSE
TRUE
Enabled
FALSE
TRUE
Busy
FALSE
TRUE
Error
FALSE
ErrorID 16#0000 ErrorID 16#0000
ErrorIDEx 16#00000000 ErrorIDEx 16#00000000
Additional Information
The XYDataToGraph function on P.228 is used to convert XYTraceData to data for displaying a broken
line graph on an NS/NA-series HMI.
Troubleshooting
The error codes, expansion error codes, status, descriptions, and corrections given in the following
table.
Expansion error
Error code Status Description Correction
code
16#0000 16#00000000 Normal end
16#3CA6 16#00000001 Incorrect Task An attempt was made to execute Execute this function block in a
Setting this function block in a task primary periodic task or a peri-
period which is not a primary odic task.
task period or a periodic task.
16#00000002 X Origin Value The value of X_Orig (X Origin Check the valid range for the
Out of Range Value) is outside the valid range. value of X_Orig (X Origin Value)
and set the value within the valid
range.
16#00000003 X Value Width The value of X_Width (X Value Check the valid range for the
Out of Range Width) is outside the valid range. value of X_Width (X Value Width)
and set the value within the valid
range.
Sysmac Library User’s Manual for Servo Press Library (W573) 225
XYDataRec
Sample Programming
This sample programming creates trace data for the SP_SingleAxisPrgOpr (Single-axis Program Oper-
ation) function block sample programming execution results that are used to display a broken-line
graph on an NS/NA-series PT. The trace data is specified as the MC_Axis000.Act.Pos (Actual Current
Position) axis variable for the horizontal axis and the MC_Axis000.Act.Trq (Actual Current Torque) axis
variable for the vertical axis.
It is added and executed after the SP_SingleAxisPrgOpr (Single-axis Program Operation) function
block sample programming.
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Processing
If XY_Rec_En (Enable Graph Trace Data Recording) is TRUE, this processing records a trace of the
specified data while the SP_SingleAxisPrgOpr (Single-axis Program Operation) function block is being
executed.
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
XY_REC OmronLib\Servo- Instance of the XYDataRec
Press\XYDataRec (Broken Line Graph Trace Data
Preparation) function block
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation
busy
XY_Rec_En BOOL Enables graph trace data
recording.
XY_Trace_Data ARRAY[0..19999] OF LREAL Trace data for graphs
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
226 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataRec
Algorithm
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
XY_REC OmronLib\Servo- Instance of the XYDataRec
Press\XYDataRec (Broken Line Graph Trace Data
Preparation) function block
SingleAxisPrgOpr_Bsy BOOL Single-axis program operation
busy
XY_Rec_En BOOL Enables graph trace data
recording.
XY_Trace_Data ARRAY[0..19999] OF LREAL Trace data for graphs
External Variables
Initial
Name Data Type Comment
Value
MC_Axis000 _sAXIS_REF --- Servo axis
Algorithm
//XYDataRec
XY_REC(
XYTraceData :=XY_Trace_Data,
Enable := SingleAxisPrgOpr_Bsy AND XY_Rec_En,
X_Type := BOOL#TRUE,
X := MC_Axis000.Act.Pos,
Y := MC_Axis000.Act.Trq,
X_Orig := LREAL#0.0,
X_Width := LREAL#0.1,
X_Direction := BOOL#TRUE,
Enabled => XY_Rec_Ed,
Busy => XY_Rec_Bsy,
Error => XY_Rec_Err,
ErrorID => XY_Rec_ErrID,
ErrorIDEx => XY_Rec_ErrIDEx
);
Sysmac Library User’s Manual for Servo Press Library (W573) 227
XYDataToGraph
XYDataToGraph
The XYDataToGraph function converts the trace data to NA/NS-series HMI broken line graph display data.
FB/
Function name Name Graphic expression ST expression
FUN
XYDataTo Broken Line FUN Out:=XYDataToGraph (
Graph Graph Dis- \\OmronLib\ServoPress\XYDataToGraph XYTraceData,
EN Out
play Data X_Init,
Conversion XYTraceData XYTraceData X_Zoom,
X_ZoomNum
X_Init Y_Zoom,
X_Zoom Y_Zoomnum,
XYGraphData);
X_ZoomNum
Y_Zoom
Y_ZoomNum
XYGraphData XYGraphData
Item Description
Library file name OmronLib_ServoPress_V1_0.slr
Namespace OmronLib\ServoPress
Function block and function number 00100
Publish/Do not publish source code Published.
Function block and function version 1.00
228 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataToGraph
Variables
Input Variables
Output Variables
In-Out Variables
Sysmac Library User’s Manual for Servo Press Library (W573) 229
XYDataToGraph
Function
This function converts XYTraceData to XYGraphData (XY Graph Display Data) NA/NS-series HMI bro-
ken line graph display data.
When converting, you can specify the X axis direction conversion start position for the contents of
XYTraceData. You can also zoom in on or zoom out from the X axis direction and Y axis direction.
XYTraceData Structure
XYTraceData is prepared using the XYDataRec (Broken Line Graph Trace Data Preparation) function
block. Refer to XYDataRec on page 1-218 for details on the XYTraceData structure.
XYGraphData Structure
The XYGraphData structure is the same as the XYTraceData structure. Specifically, the array element
numbers express the X value for each data record and the array element values express the Y value for
each data record.
Data Conversion
When you convert the data, you specify the X axis direction conversion start position and the X axis and
Y axis direction zoom as described below.
Y value
XYTraceData[102]
XYTraceData[2] XYTraceData[101]
XYTraceData[1] XYTraceData[100]
XYTraceData[0]
X value
Conversion
Y value
XYGraphData[2]=XYTraceData[102]
XYGraphData[1]=XYTraceData[101]
XYGraphData[0]=XYTraceData[100]
X value
230 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataToGraph
Y value
XYTraceData[1]
XYTraceData[2]
XYTraceData[0]
X value
Conversion
Y value
XYGraphData[4]=XYTraceData[1]
XYGraphData[3] XYGraphData[5]
XYGraphData[6]
XYGraphData[2] XYGraphData[7]
XYGraphData[1]
XYGraphData[0]
X value
XYGraphData[8]=XYTraceData[2]
Sysmac Library User’s Manual for Servo Press Library (W573) 231
XYDataToGraph
Y value
XYTraceData[4]
XYTraceData[3] XYTraceData[5]
XYTraceData[6]
XYTraceData[2] XYTraceData[7]
XYTraceData[1]
XYTraceData[0]
X value
Conversion
Y value
X value
XYGraphData[0] = Average of XYTraceData[0] through XYTraceData[3]
232 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataToGraph
Y value
XYGraphData[1] = XYTraceData[1] × 3
Y value
XYTraceData[1]
XYGraphData[2] = XYTraceData[2] × 3
Conversion
XYTraceData[2]
X value X value
XYTraceData[0] XYGraphData[0] = XYTraceData[0] × 3
Y value Y value
XYTraceData[1]
Conversion
XYGraphData[1] = XYTraceData[1] / 3
XYTraceData[2]
XYGraphData[2] = XYTraceData[2] / 3
X value X value
XYTraceData[0] XYGraphData[0] = XYTraceData[0] / 3
Additional Information
To prepare XYTraceData data, use the XYDataRec function block on P.218.
Sysmac Library User’s Manual for Servo Press Library (W573) 233
XYDataToGraph
Sample Programming
This sample programming extracts 5,000 records of data from the 1,000th record of the 20,000 records
of broken-line graph display trace data created with the XYDataRec (Broken-line Graph Trace Data
Preparation) function block, and it creates 600 records of display data suitable for displaying on an
NS/NA-series PT.
It is added and executed after the SP_SingleAxisPrgOpr (Single-axis Program Operation) function
block and XYDataRec (Broken-line Graph Trace Data Preparation) function block sample program-
ming.
Conditions
The conditions are the same as those for the SP_SingleAxisPrgOpr (Single-axis Program Operation)
function block sample programming.
Processing
The graph drawing data is created with the specified start point (array index) and scale ratio when
XY_Graph_StartPG (Creation Trigger for Graph Drawing Data) changes to TRUE.
234 Sysmac Library User’s Manual for Servo Press Library (W573)
XYDataToGraph
Ladder Diagram
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
XY_Trace_Data ARRAY[0..19999] OF LREAL Trace data for graphs
XY_Graph_StartPg BOOL Creation trigger for graph drawing
data
XY_Graph_Data ARRAY[0..599] OF LREAL Graph drawing data
Algorithm
Sysmac Library User’s Manual for Servo Press Library (W573) 235
XYDataToGraph
ST
The following gives the main variables.
Internal Variables
Initial
Name Data Type Comment
Value
XY_Trace_Data ARRAY[0..19999] OF LREAL Trace data for graphs
XY_Graph_StartPg BOOL Creation trigger for graph drawing
data
XY_Graph_Data ARRAY[0..599] OF LREAL Graph drawing data
Algorithm
//Generate graph plots data.
IF UpTrig_XY_Graph_StartPg=TRUE THEN
//Transform 5000 records with a start index 1000 from all 20000 records of
XY_Trace_Data to 600 records of graph plots.
XY_Graph_X_Init:=UINT#1000;
XY_Graph_X_Zoom:=BOOL#FALSE;
X_Multiple:=REAL#5000.0/REAL#600.0;
IF X_Multiple<=REAL#255.0 THEN
XY_Graph_X_ZoomNum:=DINT_TO_USINT(RoundUp(X_Multiple));
ELSE
XY_Graph_X_ZoomNum:=USINT#255;
END_IF;
XY_Graph_Y_Zoom:=BOOL#FALSE;
XY_Graph_Y_ZoomNum:=USINT#1;
END_IF;
//XYGraphToData
XY_Graph_Out:=\\OmronLib\ServoPress\XYDataToGraph(
EN := UpTrig_XY_Graph_StartPg,
XYTraceData := XY_Trace_Data,
X_Init := XY_Graph_X_Init,
X_Zoom := XY_Graph_X_Zoom,
X_ZoomNum := XY_Graph_X_ZoomNum,
Y_Zoom := XY_Graph_Y_Zoom,
Y_ZoomNum := XY_Graph_Y_ZoomNum,
XYGraphData := XY_Graph_Data
);
236 Sysmac Library User’s Manual for Servo Press Library (W573)
Appendix
Sysmac Library User’s Manual for Servo Press Library (W573) 237
Referring to Library Information
Attributes of Libraries
238 Sysmac Library User’s Manual for Servo Press Library (W573)
Referring to Library Information
Sysmac Library User’s Manual for Servo Press Library (W573) 239
Referring to Library Information
240 Sysmac Library User’s Manual for Servo Press Library (W573)
Referring to Function Block and Function Source Codes
Use the following procedure to refer to the source codes of function blocks and functions.
Sysmac Library User’s Manual for Servo Press Library (W573) 241
Referring to Function Block and Function Source Codes
242 Sysmac Library User’s Manual for Servo Press Library (W573)
OMRON AUTOMATION AMERICAS HEADQUARTERS • Chicago, IL USA • 847.843.7900 • 800.556.6766 • www.omron247.com
OMRON ELECTRONICS DE MEXICO • SALES OFFICE OTHER OMRON LATIN AMERICA SALES
Apodaca, N.L. • 52.81.11.56.99.20 • 01-800-226-6766 • mela@omron.com 54.11.4783.5300
OMRON EUROPE B.V. • Wegalaan 67-69, NL-2132 JD, Hoofddorp, The Netherlands. • +31 (0) 23 568 13 00 • www.industrial.omron.eu
W573-E1-02 11/16 Note: Specifications are subject to change. © 2016 Omron. All Rights Reserved. Printed in U.S.A.