background image

When the code is imported to the Sysmac Studio, the BOOL variables are added as 
shown below. 

 

The program to call the function block is written in the ladder diagram language as 
shown below. 

 

 

Additional Information 

 

Refer to the 

Sample File No. 6 PLCCoderDemoMC_LD.mdl

 that is provided separately 

for the Simulink model used in this section. 
Refer to the 

Sample File No. 7 PLCCoderDemoMC_LD.smc

 that is provided separately 

for the program used in this section. 

34 

 

Summary of Contents for DA0271

Page 1: ...Machine Automation Controller NJ series Startup Guide for Simulink PLC Coder Sysmac Studio SYSMAC SE20 NJ501 NJ301 R88D KN ECT GX AD0471 DA0271 W529 E1 01...

Page 2: ...ssumed 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 subjec...

Page 3: ...l safety precautions precautions for safe use and precautions for correct use Intended Audience This guide is intended for the following personnel Personnel in charge of introducing FA systems Personn...

Page 4: ...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 maintaine...

Page 5: ...ron 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 conditio...

Page 6: ...imulink PLC Coder Applicability of codes that were outputted from Simulink PLC Coder must be judged by the customer Check the user program for proper execution before you use it for actual operation T...

Page 7: ...and functions General specifications Installation and wiring Maintenance and inspection Use this manual together with the NJ series CPU Unit Software User s Manual Cat No W501 NJ series CPU Unit Soft...

Page 8: ...troller Concepts on managing errors that may be detected in an NJ series Controller and information on individual errors are described Use this manual together with the NJ series CPU Unit Hardware Use...

Page 9: ...istory A manual revision code appears as a suffix to the catalog number on the front and back covers of the manual 7 Cat No W529 E1 01 Revision Revision code Date Revised content A June 2013 Original...

Page 10: ...e Devices and Installing the Software 12 2 2 Designing the Control Algorithm 12 3 Setting up the System 14 3 1 System Setup Procedures 14 3 2 Simulink PLC Coder Sysmac Studio Operation Procedure 15 3...

Page 11: ...on and configuration devices used in this Guide The following figure represents the system configuration Computer Sysmac Studio MATLAB Simulink and Simulink PLC Coder are installed USB cable NJ PA3001...

Page 12: ...0 AC Servomotors R88M K10030L Motor Power Cables for the AC Servo Drives R88A CAKA003S Encoder Cables for the AC Servo Drives R88A CRKA003C AC Servomotors Servo Drives Built in EtherCAT Communications...

Page 13: ...on check using the actual devices are given as the startup procedure The single axis Servo system that is set up in this Guide performs the single axis positioning operation on the following path The...

Page 14: ...k The code is created for the Controller by the Simulink PLC Coder Therefore you need to build the model using a block supported by the Simulink PLC Coder Additional Information Access the website of...

Page 15: ...d on the Sysmac Studio 500 s 1 ms 2 ms or 4 ms The following figure shows the inside of the Controller block The Controller block is composed of two blocks the CommandPositionGenerator block for creat...

Page 16: ...ation 3 2 4 Creating the EtherCAT Network Configuration You register a R88D KN01L ECT Servo Drive that operates as axis 0 on the EtherCAT network configuration 3 2 5 Setting the Axis You add an axis t...

Page 17: ...code for the Sysmac Studio and output the code with test code from the Simulink 1 Open the Sample File No 1 PLCCoderDemoMC mdl that is provided separately on the Simulink 2 Click the Controller block...

Page 18: ...4 Select the Generate testbench for subsystem check box 5 Click the Apply Button 6 Click the Generate Code Button 16...

Page 19: ...ory Additional Information When you adjust the parameters after code generation you generate the code as a variable not a constant literal Access the website of The MathWorks Inc or refer to the Simul...

Page 20: ...o the Sysmac Studio Version 1 Operation Manual Cat No W504 for how to use the Sysmac Studio 1 Start the Sysmac Studio and create a new project Set the Select Device Area as shown below Category Contro...

Page 21: ...ock whose code is outputted by the Simulink PLC Coder and its internal blocks CommandPositionGenerator and PositionController are imported as function blocks of Sysmac Studio TestBench is a function b...

Page 22: ...ange by a simulation 1 Double click the Task Settings in the Multiview Explorer to display the Task Settings Tab Page 2 Set the task period to 1 ms in the Task Settings View on the Sysmac Studio so th...

Page 23: ...rue and testCycleNum is the value of TEST_CYCLE_COUNT written in the comment You can confirm that calculation accuracy of the output data is the same level as the Simulink within the acceptable error...

Page 24: ...nformation The initial value of the acceptable error depends on the data type as shown below Set an appropriate value according to the actual application Integer data 0 Match REAL data 0 0001 LREAL da...

Page 25: ...master The Servo Drive is added under the master with a node address of 1 Additional Information To use digital I O devices analog I O devices and encoder input devices add the devices using the same...

Page 26: ...Explorer and right click Axis Settings and select Add Axis Settings from the menu 2 Double click MC_Axis000 0 Axis 0 that was added under Motion Control Setup Axis Settings in the Multiview Explorer t...

Page 27: ...figuration Unit of display mm Command pulse count per motor rotation 1048576 pulse rev Work travel distance per motor rotation 10 mm rev 5 Make the Operation Settings according to the mechanical confi...

Page 28: ...er and a program for outputting command values to the Servo Drive 1 Delete TestBench and MainTB because they are used for the test to check the calculation accuracy Right click TestBench in the Multiv...

Page 29: ...ith other devices and other control procedures Additional Information Refer to the Sample File No 2 PLCCoderDemoMC smc that is provided separately for the above program written in ST language Addition...

Page 30: ...ngs Tab Page 4 Set the task period to 1ms in the Task Settings View on the Sysmac Studio so that the period matches the sampling time of the Controller on the Simulink 5 In the Program Assignment Sett...

Page 31: ...n Download You transfer the programs and parameter settings to the physical CPU Unit 29 1 Select Online from the Controller Menu 2 Select Synchronization from the Controller Menu 3 Click the Transfer...

Page 32: ...ead and understand the manuals for all devices that make up the system to ensure that the system is used safely Review the entire contents of these manuals including all safety precautions precautions...

Page 33: ...rgetPosition PositionControl i_Controller i0_PositionController CommandPosition PositionControl i_Controller ActualPosition PositionControl i_Controller CommandVelocity 4 Click the Start Trace Button...

Page 34: ...n and command value output to True to start positioning 7 When you click the Stop Button with write square icon or the trace data becomes full the data trace operation will stop and the results will b...

Page 35: ...t least one BOOL input variable and one BOOL output variable This section describes the procedure for adding boolean signals to the block on the Simulink Additional Information You also can add BOOL v...

Page 36: ...lock is written in the ladder diagram language as shown below Additional Information Refer to the Sample File No 6 PLCCoderDemoMC_LD mdl that is provided separately for the Simulink model used in this...

Page 37: ...ains the program to output torque commands cyclically 4 PLCCoderDemoMC_ADDA mdl File that contains the Simulink model that shows the usage example of GX AD0471 Analog Input Terminal and GX DA0271 Anal...

Page 38: ...2013 0613 W529 E1 01...

Reviews: