User manual MATLAB SIMULINK PLC CODER 1
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. Diplodocs 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.
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. [. . . ] 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. The coder also automatically generates a test bench (test harness) using the text bench data. The test bench verifies that the generated code is functionally and numerically equivalent to the Simulink model. To perform this verification, import the generated structured text and the test bench data into your target IDE.
Generating and Importing Structured Text
This topic describes the basic procedure for how to generate test bench code. This topic assumes that you have an appropriately configured model from which to generate structured text. If you have not yet done this procedure, see "Preparing Your Model to Generate Structured Text Code" on page 1-11. All demos are located in the matlabroot\toolbox\plccoder\plccoderdemos folder.
1 If you do not have the plcdemo_simple_subsystem model open, open it now. 2 Ensure that you have connected the inputs and outputs of the subsystem
for which you want to generate the test bench. You can import this test bench with the generated code to the target IDE to verify simulation results with Simulink output. For example:
3-2
Working with Generated Structured Text
3 Right-click the Subsystem block and select PLC Coder > Options.
The Configuration Parameters dialog box is displayed.
4 In PLC Coder > General options > Target IDE, select your target IDE,
for example, CoDeSys 2. 3.
5 Select the Generate testbench for subsystem check box. 7 Click the Generate code button.
This button: · Generates structured text code (same as the PLC Coder > Generate Code for Subsystem option) · Generates test bench for code through Simulink simulation
3-3
3
Generating Test Bench Code
· Combines generated code and test bench into model_name. exp (for example, plcdemo_simple_subsystem. exp). When the code generation is complete, an information window is displayed.
8 Click OK.
The Simulink PLC Coder software generates structured text code and writes it to current_folder/plcsrc/plcdemo_simple_subsystem. Depending on the target IDE, the coder might generate additional supporting files.
9 See the user manual for your target IDE for information on how to import
generated code into the target IDE.
Generated Files
Depending on the target IDE platform, the Simulink PLC Coder software generates code into one or more files. See "Generating Structured Text Code
3-4
Working with Generated Structured Text
from the Model Window" on page 1-20 for list of the target IDE platforms and the possible generated files.
3-5
3
Generating Test Bench Code
3-6
4
Working with Tunable Parameters in the Simulink PLC Coder Environment
4
Working with Tunable Parameters in the Simulink® PLC CoderTM Environment
Configuring Tunable Parameters for Your Model
In this section. . . "About Tunable Parameters in the Simulink® PLC Coder Environment" on page 4-2 "Workflow Overview" on page 4-2 "Identifying Tunable Parameters" on page 4-3 "Defining Tunable Parameters in the MATLAB Workspace" on page 4-5 "Configuring Parameters to Be Tunable" on page 4-8 "Tunable Parameters Considerations" on page 4-12
About Tunable Parameters in the Simulink PLC Coder Environment
Dialog parameters can be either tunable or nontunable. A tunable parameter is a parameter that you can change while the simulation is running. [. . . ] Display demos in the MATLAB Help browser.
plccoderdemos
See Also
plcopenconfigset
8-2
plccoderpref
Purpose Syntax
Set target IDE
plccoderpref plccoderpref('plctargetide') plccoderpref('plctargetide', IDEcodename) plccoderpref('plctargetide', 'default') plccoderpref displays the current set of user preferences, including the default target IDE. plccoderpref('plctargetide') returns the current default target IDE. This default can be the target IDE set previoiusly, or the factory default. plccoderpref('plctargetide', IDEcodename) sets the default target IDE to the one that you specify in IDEcodename. [. . . ]
DISCLAIMER TO DOWNLOAD THE USER GUIDE MATLAB SIMULINK PLC CODER 1
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.