Simulink RN
Simulink RN
Notes
How to Contact MathWorks
www.mathworks.com Web
comp.soft-sys.matlab Newsgroup
www.mathworks.com/contact_TS.html Technical Support
508-647-7000 (Phone)
508-647-7001 (Fax)
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Contents
R2014a
Static code metrics report . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Code generation for Siemens STEP 7 V5.5 IDE, B&R
Automation Studio 4 IDE, and Beckhoff TwinCAT 3
IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Model block description in generated code for CoDeSys 2.3
IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Simulink.Parameter description in generated code for
Codesys 2.3 IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Change in Diagnostic Viewer launch behavior after code
generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
R2013b
Masked parameters for atomic subsystems . . . . . . . . . . . . . 4
Reusable code for intrinsic functions . . . . . . . . . . . . . . . . . . 4
Millisecond and microsecond units with absolute-time
temporal logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
PC WORX IDE support improvements including enhanced
support for global tunable parameters . . . . . . . . . . . . . . 4
Temporary variable minimization . . . . . . . . . . . . . . . . . . . . 5
Relative tolerance for test bench data comparison . . . . . . . 5
R2013a
Code generation for OMRON Sysmac Studio IDE . . . . . . . 8
Code generation for multirate models in single-tasking
mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
iii
R2012b
Workflow for behavioral simulation and code generation of
motion instructions for RSLogix 5000 IDE . . . . . . . . . . . 10
Code generation report with bidirectional traceability
between model and code . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Propagation of block descriptions to generated
code comments and RSLogix 5000 AOI/routine
descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Code generation optimizations for efficient casts and signal
reuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Internal signals available as optional AOI outputs for
debugging in RSLogix 5000 IDE . . . . . . . . . . . . . . . . . . . 12
Rockwell Automation RSLogix 5000 IDE Version 19 . . . . . 12
Absolute Time Temporal Logic . . . . . . . . . . . . . . . . . . . . . . . 12
R2012a
Code Generation for Rockwell Automation RSLogix 5000
Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Global Tunable Parameters for Generated Code from
Rockwell Automation RSLogix 5000 Add-On Instructions
and Routine Formats and Phoenix Contact PC WORX . . 14
Support for Absolute Time Temporal Logic for the Rockwell
Automation RSLogix 5000 IDE . . . . . . . . . . . . . . . . . . . . 15
Integration of Externally Defined Symbols in Generated
Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Support for Configuring Tunable Parameters Using
Simulink.Parameter Objects . . . . . . . . . . . . . . . . . . . . . . 15
Author Creation Data, Descriptions, and Sample Times in
Generated Code Header Comments . . . . . . . . . . . . . . . . . 15
Support for atan2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Convenience Dynamic Lookup Table Block . . . . . . . . . . . . . 16
New Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
R2011b
Automatic IDE Import of Subsystem Code Without Test
Bench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
iv Contents
Subsystem Function Block Code . . . . . . . . . . . . . . . . . . . . . 20
New Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
R2011a
Support for New PLC Target IDEs . . . . . . . . . . . . . . . . . . . 24
Generated Code File Name Can Now Be Renamed . . . . . . 24
Generated Code File Header Change . . . . . . . . . . . . . . . . . . 24
Support for Lookup Table Blocks . . . . . . . . . . . . . . . . . . . . . 24
Support for Fixed Point Data Types . . . . . . . . . . . . . . . . . . 24
CORDIC Trigonometric Functions . . . . . . . . . . . . . . . . . . . . 24
64-Bit Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
New Demos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
R2010b
Support for Triggered Subsystems . . . . . . . . . . . . . . . . . . . . 28
Support for New PLC Target IDEs . . . . . . . . . . . . . . . . . . . 28
Automatic Import of Generated Code . . . . . . . . . . . . . . . . . 28
New Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
R2010a
New Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
v
vi Contents
R2014a
Version: 1.7
1
R2014a
2
R2013b
Version: 1.6
3
R2013b
To see how mask parameters map to generated code, see Generated Code
Structure for Subsystem Mask Parameters.
• Global tunable parameters that are structures and array data types
are initialized in a PLC_INIT_PARAMETERS function block. For more
information, see Global Tunable Parameter Initialization for PC WORX.
• floor and ceil rounding is supported.
• Array type names incorporate data type description and size.
For example, if you have a 51-element array of real data, the generated
code for the array data type is:
4
Temporary variable minimization
To learn more about test bench data comparison, see How Test Bench
Verification Works.
5
R2013a
Version: 1.5
7
R2013a
To open an example that shows how to generate code from a multirate model,
at the command line, enter:
plcdemo_multirate
8
R2012b
Version: 1.4
9
R2012b
10
Propagation of block descriptions to generated code comments and RSLogix™ 5000 AOI/routine descriptions
For Rockwell Automation RSLogix 5000 AOI/routine target IDEs, the coder
also generates the subsystem block description text as an AOI or routine
description L5X XML tag. The IDE can then import the tag as part of AOI
and routine definition in the generated code.
11
R2012b
For more information, see Internal Signals for Debugging in RSLogix 5000
IDE.
12
R2012a
Version: 1.3
13
R2012a
• Load the code generated from routines without first restarting the Rockwell
Automation RSLogix 5000 PLC. You can now:
• Take advantage of RSLogix user defined types (UDTs) to preserve model
hierarchy in routine code and represent model.
• Observe that reusable subsystems become separate routine instances and
access instance data in program UDTs.
14
Support for Absolute Time Temporal Logic for the Rockwell Automation® RSLogix™ 5000 IDE
Note If your model uses absolute time temporal logic, you cannot create test
bench code for that model.
15
R2012a
New Examples
The following examples are new:
16
New Examples
17
R2011b
Version: 1.2.1
19
R2011b
2 In the Simulink editor, right-click the subsystem and select PLC Code
Generation > Generate and Import Code for Subsystem.
In previous releases, the coder generated and imported test bench code into
the target IDE regardless of the setting of the Generate testbench for
subsystem check box.
In generated code, the function block code of the top-level subsystem has
been simplified. The coder now generates the function block code depending
on whether or not the top-level subsystem has internal state. In previous
releases, the coder always generated the function block code with the
ssMethodType parameter for top-level subsystems.
Compatibility Considerations
This release simplifies the function block code of the top-level subsystem for
generated code.
• If the top-level subsystem in the Simulink model has internal state, the
generated function block for the block will have an extra first parameter
ssMethodType of integer type. This extra parameter is in addition to the
function block I/O parameters mapped from Simulink block I/O ports.
To use the function block:
1 Initialize the block by calling the function block with ssMethodType set
to integer constant SS_INITIALIZE.
20
New Demo
New Demo
The following demo is new:
21
R2011a
Version: 1.2
23
R2011a
See Supported IDE Platforms in the Simulink PLC Coder User’s Guide for
more information.
24
64-Bit Support
64-Bit Support
The Simulink PLC Coder product supports 64-bit systems. You can still use
the Simulink PLC Coder product with 32-bit IDEs.
See the MathWorks® website at Supported IDEs for a list of supported IDEs
and platforms.
New Demos
The following demos are new:
25
R2010b
Version: 1.1
Bug Fixes: No
27
R2010b
See Supported IDE Platforms in the Simulink PLC Coder User’s Guide for
more information.
You can take advantage of this capability for the following PLC IDEs:
28
New Demo
New Demo
A new Simulink PLC Coder demo, Speed Cruise Control System Using
Simulink and Stateflow, illustrates code generated for a cruise control
controller subsystem using a triggered subsystem.
29
R2010a
Version: 1.0
Bug Fixes: No
31
R2010a
New Product
Simulink PLC Coder generates hardware-independent IEC 61131-3
Structured Text from Simulink models, Stateflow charts, and Embedded
MATLAB® functions. The Structured Text is generated in PLCopen and other
file formats supported by widely used integrated development environments
(IDEs). As a result, you can compile and deploy your application to numerous
programmable logic controller (PLC) and programmable automation
controller (PAC) devices.
Simulink PLC Coder generates test benches that help you verify the
Structured Text using PLC and PAC IDEs and simulation tools.
Key features:
32