User manual MATLAB SIMULINK PLC CODER 1
Lastmanuals offers a socially driven service of sharing, storing and searching manuals related to use of hardware and software : user guide, owner's manual, quick start guide, technical datasheets... DON'T FORGET : ALWAYS READ THE USER GUIDE BEFORE BUYING !!!
If this document matches the user guide, instructions manual or user manual, feature sets, schematics you are looking for, download it now. Lastmanuals provides you a fast and easy access to the user manual MATLAB SIMULINK PLC CODER 1. We hope that this MATLAB SIMULINK PLC CODER 1 user guide will be useful to you.
Lastmanuals help download the user guide MATLAB SIMULINK PLC CODER 1.
Manual abstract: user guide MATLAB SIMULINK PLC CODER 1
Detailed instructions for use are in the User's Guide.
[. . . ] Simulink® PLC CoderTM 1 User's Guide
How to Contact The MathWorks
Web Newsgroup www. mathworks. com/contact_TS. html Technical Support
www. mathworks. com comp. soft-sys. matlab suggest@mathworks. com bugs@mathworks. com doc@mathworks. com service@mathworks. com info@mathworks. com
Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information
508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site. Simulink® PLC CoderTM User's Guide © COPYRIGHT 2010 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. [. . . ] The code invokes the outputs per the Simulink execution semantics.
2-5
2
Mapping Simulink® Semantics to Structured Text
How Stateflow Subsystem Code Maps to Function Blocks
This topic assumes that you have generated structured text code from a Simulink model. If you have not yet done so, see "Generating Structured Text Code from the Model Window" on page 1-20. The example in this topic shows generated code for the CoDeSys Version 2. 3 PLC IDE. Generated code for other IDE platforms looks different.
1 Open the plcdemo_stateflow_controller model. 2 Right-click the ControlModule chart and select PLC Coder > Generate
Code for Subsystem. The Simulink PLC Coder software generates structured text code and places it in current_folder/plcsrc/plcdemo_stateflow_controller. exp.
3 If you do not have the plcdemo_stateflow_controller. exp file open,
open it now in the MATLAB editor. This figure illustrates the mapping of the generated code for a Simulink Subsystem block that contains a Stateflow chart to structured text components.
2-6
How Stateflow® Subsystem Code Maps to Function Blocks
Inlined code for Stateflow chart
4 Examine the generated structured text code.
The Simulink PLC Coder software aggressively inlines the generated code for the Stateflow chart. The coder performs this inlining because different functions from Stateflow charts share some global state data. However, function blocks in structured text code do not share state data. As a result, the coder software cannot map these functions onto separate function blocks. Instead, it must inline these functions.
2-7
2
Mapping Simulink® Semantics to Structured Text
How Embedded MATLAB Subsystem Code Maps to Function Blocks
This topic assumes that you have generated structured text code from a Simulink model. If you have not yet done so, see "Generating Structured Text Code from the Model Window" on page 1-20. The example in this topic shows generated code for the CoDeSys Version 2. 3 PLC IDE. Generated code for other IDE platforms looks different.
1 Open the plcdemo_eml_tankcontrol model. 2 Right-click the TankControl block and select PLC Coder > Generate
Code for Subsystem. The Simulink PLC Coder software generates structured text code and places it in current_folder/plcsrc/plcdemo_eml_tankcontrol. exp.
3 If you do not have the plcdemo_eml_tankcontrol. exp file open, open it
now in the MATLAB editor. This figure illustrates the mapping of the generated code for a Simulink Subsystem block that contains an Embedded MATLAB Function block to structured text components. The coder tries to perform inline optimization on the generated code for Embedded MATLAB subfunctions. If the coder determines that it is more efficient to leave the subfunction as is, it places the generated code in a structured text construct called FUNCTION. The main difference between a FUNCTION_BLOCK and FUNCTION is that a FUNCTION cannot have states and cannot access global variables.
2-8
How Embedded MATLAB® Subsystem Code Maps to Function Blocks
Embedded MATLAB code
Generated Embedded MATLAB function code
4 Examine the generated structured text code.
2-9
2
Mapping Simulink® Semantics to Structured Text
How Alias Data Types Map in Generated Code
The coder maps alias data types to the base data type in the generated code.
2-10
3
Generating Test Bench Code
3
Generating Test Bench Code
Working with Generated Structured Text
In this section. . . "How Test Bench Verification Works" on page 3-2 "Generating and Importing Structured Text" on page 3-2 "Generated Files" on page 3-4
How Test Bench Verification Works
The Simulink PLC Coder software simulates your model and automatically captures the input and output signals for the subsystem that contains your algorithm. This set of input and output signal data is the test bench data. [. . . ] plccoderpref('plctargetide', IDEcodename) sets the default target IDE to the one that you specify in IDEcodename. This command ensures
Description
that IDEcodename persists as the default target IDE for all future MATLAB sessions.
plccoderpref('plctargetide', 'default') sets the default target IDE to the factory default target IDE ('codesys23').
Input Arguments
'plctargetide'
String directive that specifies the default target IDE.
'IDEcodename'
String that specifies the default target IDE. String must be one of: Name
codesys23 codesys33 rslogix5000
Description 3S-Smart Software Solutions CoDeSys Version 2. 3 (default) target IDE 3S-Smart Software Solutions CoDeSys Version 3. 3 target IDE Rockwell Automation RSLogix 5000 Series target IDE
8-3
plccoderpref
Name
brautomation30 plcopen twincat211 generic 'default'
Description B&R Automation Studio 3. 0 target IDE PLCOpen XML target IDE Beckhoff TwinCAT 2. 11 target IDE Generic target IDE
String directive that sets 'plctargetide' to factory default ('codesys23').
Example
Return the current default target IDE.
plccoderpref('plctargetide')
Set rslogix5000 as the new default target IDE.
plccoderpref('plctargetide', 'rslogix5000')
8-4
plcgeneratecode
Purpose Syntax Description
Generate structured text for subsystem
generatedfiles = plcgeneratecode(subsystem) generatedfiles = plcgeneratecode(subsystem) generates structured text for the specified atomic subsystem in a model. subsystem is the fully qualified path name of the atomic subsystem. [. . . ]
DISCLAIMER TO DOWNLOAD THE USER GUIDE MATLAB SIMULINK PLC CODER 1 Lastmanuals offers a socially driven service of sharing, storing and searching manuals related to use of hardware and software : user guide, owner's manual, quick start guide, technical datasheets... In any way can't Lastmanuals be held responsible if the document you are looking for is not available, incomplete, in a different language than yours, or if the model or language do not match the description. Lastmanuals, for instance, does not offer a translation service. Click on "Download the user manual" at the end of this Contract if you accept its terms, the downloading of the manual MATLAB SIMULINK PLC CODER 1 will begin.