Real-Time Workshop® For Use with Simulink ®Getting StartedVersion 6
1 What Is Real-Time Workshop?1-4- The flexible scripting capabilities of the Target Language Compiler enable you to fully customize generated code.- E
3 Working with Real-Time Workshop3-44External mode supports communication via TCP/IP, serial, and custom transport protocols. The MEX-file name field
Quick Start Tutorials3-457 Click Apply to save the Interface settings.8 Save the model.9 In the Real-Time Workshop pane, click Build to generate code
3 Working with Real-Time Workshop3-46The top three buttons are for use after the target program has started. The two lower buttons open separate dialo
Quick Start Tutorials3-474 Make sure that the External Signal & Triggering dialog is set to the defaults as shown:-Select all check box is selecte
3 Working with Real-Time Workshop3-48Click Close, and then close the External Mode Control Panel.For information on the options mentioned above, see “
Quick Start Tutorials3-496 Open Scope blocks A and B. At this point, no signals are visible on the scopes. When you connect Simulink to the target pro
3 Working with Real-Time Workshop3-50Part 4: Tuning ParametersYou can change the gain factor of either Gain block by assigning a new value to the vari
Quick Start Tutorials3-51Tutorial 6: Generating Code for a Referenced ModelThe Model block, introduced in Version 6 of Simulink, enables an existing S
3 Working with Real-Time Workshop3-524 Right-click any of the three highlighted blocks and select Create Subsystem from the pop-up context menu. You c
Quick Start Tutorials3-53The border of the vdpmult subsystem thickens to indicate that it is now atomic. An atomic subsystem executes as a unit rather
Introducing Real-Time Workshop1-5• Target support- Turnkey solutions for rapid prototyping substantially reduce design cycles, allowing for fast turna
3 Working with Real-Time Workshop3-548 Open the Configuration Parameters dialog from the Simulation menu or by typing Ctrl+E.The next four steps bypas
Quick Start Tutorials3-55In this exercise you only supply the first two calling arguments (a model name and a target directory) and no return argument
3 Working with Real-Time Workshop3-56Code for model reference simulation targets is placed in the slprj/sim subdirectory. Generated code for GRT, ERT,
Quick Start Tutorials3-57This instructs the vdptop_converted model (and later its executable) to log time and output data to MAT-files for each time s
3 Working with Real-Time Workshop3-586 Use the Model Explorer to inspect the newly created build directory, vdptop_converted_grt_rtw, in your current
Quick Start Tutorials3-59To view a model’s generated code in Model Explorer, the model must be open. To open a file in a text editor, click a filename
3 Working with Real-Time Workshop3-6011 A Model Explorer node named Code for vdpmult also appears under the node Code for vdptop_converted. Expand thi
Quick Start Tutorials3-61/* Output and update for referenced model: 'vdpmult'*/void mr_vdpmult(const real_T *rtu_0, const real_T *rtu_1, rea
3 Working with Real-Time Workshop3-62Working with Project DirectoriesWhen you view generated code in Model Explorer, the files listed in the Contents
Quick Start Tutorials3-63
1 What Is Real-Time Workshop?1-6• Annotation of the generated code using the Description block property.• Control over naming and storage class for pa
3 Working with Real-Time Workshop3-64
Glossary-1 Glossaryapplication modulesWith respect to Real-Time Workshop program architecture, these are collections of programs that implement functi
Glossary-2expression foldingCode optimization technique that minimizes the computation of intermediate results at block outputs and the storage of su
GlossaryGlossary-3host system Computer system on which you create and may compile your real-time application. Also referred to as emulation hardware.i
Glossary-4part of a Simulink model, it is by default noninlined unless you write your own .tlc file that inlines it.nonreal-time Simulation environme
GlossaryGlossary-5simulation targetSet of code files generated for a model which is referenced by a Model block. Simulation target code is generated i
Glossary-6virtual block Connection or graphical block, for example a Mux block, that has no algorithmic functionality. Virtual blocks incur no real-t
Index-1IndexBblock target file 2-17build directorycontents of 2-27f14 example 3-18naming convention 2-26build processsteps in 2-15Ccode formatdefiniti
IndexIndex-2subsystem.c 2-24subsystem.h 2-24generic real-time (GRT) target 3-4tutorial 3-9Hhostand target 3-3Mmake utility 2-13components 3-3MAT-files
IndexIndex-3system target file 3-4TLC scripts 2-17template makefileintroduction to 3-5tutorialsbuilding generic real-time program 3-9code generation 3
Introducing Real-Time Workshop1-7Spiral Design ProcessWhen you work with tools from The MathWorks, your model represents your understanding of your sy
IndexIndex-4
1 What Is Real-Time Workshop?1-8can verify that an algorithm works on a real-world rapid prototyping system. The spiral process lends itself naturally
Introducing Real-Time Workshop1-9Roles of MathWorks Products in Software DevelopmentEarly in the design process, you use MATLAB and Simulink to help y
1 What Is Real-Time Workshop?1-10Real-Time Windows Target or the xPC Target. With a rapid prototyping target, you connect your model to your physical
Installing Real-Time Workshop1-11Installing Real-Time WorkshopYour platform-specific MATLAB installation documentation provides all the information yo
1 What Is Real-Time Workshop?1-12Third-Party Compiler Installation on WindowsMost Real-Time Workshop targets create an executable that runs on your wo
Installing Real-Time Workshop1-13• Replace %INTELC71% with the root directory of the Intel Compiler installation.LCCThe freeware LCC C compiler is shi
How to Contact The MathWorks:www.mathworks.com Webcomp.soft-sys.matlab [email protected] Technical [email protected] Product
1 What Is Real-Time Workshop?1-14If the WATCOM environment variable is not defined, you must define it to point to where you installed your Watcom com
Installing Real-Time Workshop1-15On UNIX. On UNIX, the Real-Time Workshop build process uses the default compiler. The cc compiler is the default on a
1 What Is Real-Time Workshop?1-16Real-Time Workshop DemosA good way to familiarize yourself with Real-Time Workshop is by browsing through its suite o
Help and Documentation1-17Help and DocumentationReal-Time Workshop software is shipped with this Getting Started guide. Users of this book should be f
1 What Is Real-Time Workshop?1-181 In the MATLAB window, click Desktop -> Help, Help -> Full product family help, or click the ? icon on the too
Help and Documentation1-19You can customize output from Real-Time Workshop at the block, target, and makefile levels. For advanced uses, you may have
1 What Is Real-Time Workshop?1-20
2Building an ApplicationThis chapter expands the high-level discussion of code generation and the build process given in Chapter 1, “What Is Real-Tim
2 Building an Application2-2Real-Time Workshop WorkflowThe typical workflow for applying Real-Time Workshop to the application development process inv
Real-Time Workshop Workflow2-3ConfigurationNo YesDoneAdjust Configuration SettingsRun Model Advisor RequiresTuning?Generate CodeCode OK? Map Applicat
iContents1What Is Real-Time Workshop?Introducing Real-Time Workshop . . . . . . . . . . . . . . . . . . . . . . 1-2Components and Features . . .
2 Building an Application2-4Mapping Application Requirements to Configuration OptionsThe first step to applying Real-Time Workshop to the application
Real-Time Workshop Workflow2-5• What is the highest priority for your application — traceability, efficiency, extra safety precaution, or some other c
2 Building an Application2-6OptimizationBlock reduction optimizationClear Clear Set No impact SetImplement logic signals as Boolean data (vs. double)N
Real-Time Workshop Workflow2-7Hardware ImplementationNumber of bitsNo impact No impact Target specificNo impact 8, 16, 32, 32Real-Time WorkshopGenerat
2 Building an Application2-8* Backward compatibility with previous release.Setting Configuration OptionsOnce you have mapped your application requirem
Real-Time Workshop Workflow2-9Although you can use the Model Advisor to improve model simulation, it is particularly useful for identifying aspects of
2 Building an Application2-10• You want to inspect the generated code. Is Real-Time Workshop generating what you expect?• You need to integrate custom
Real-Time Workshop Workflow2-11For a more detailed discussion of the build process, see “Automatic Program Building” on page 2-13 and “The Build Proce
2 Building an Application2-125 Click Apply.The name of the active configuration in the Model Hierarchy pane changes to the name you typed.6 Save the m
Automatic Program Building2-13Automatic Program BuildingReal-Time Workshop builds programs automatically for real-time applications in a variety of ho
ii ContentsThe Build Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15Model Compilation . . . . . . . . . . . .
2 Building an Application2-14A high-level M-file command controls the Real-Time Workshop build process. By default, Real-Time Workshop issues the comm
The Build Process2-15The Build ProcessReal-Time Workshop generates C code only or generates the C code and produces an executable image, depending on
2 Building an Application2-16report contents vary depending on the target, but all reports feature clickable links to generated source files. The foll
The Build Process2-17• Computes work vector sizes, such as those used by S-functions. (For more information about work vectors, refer to the Simulink
2 Building an Application2-18Note Real-Time Workshop executes all user-written S-function target files, but optionally executes block target files fo
The Build Process2-19During the final stage of processing, Real-Time Workshop invokes the generated make file, model.mk, which in turn compiles and li
2 Building an Application2-20This stage is optional, as illustrated by the control logic in the preceding figure. You might choose to omit this stage,
The Build Process2-21How Automatic Program Building Is ControlledCustomGenerateMakefileClick BuildButtonCreateExecutable?No InvokeYesGenerateCodeTempl
2 Building an Application2-22Files and Directories Created by the Build ProcessThe following sections discuss• “Files Created During Build Process” on
The Build Process2-23| rt_nonfinite.c| modelsources.txt| f14_dt.h|+---tlc| This directory contains TLC files generated during the build| process. Thes
iiiIndex
2 Building an Application2-24- Exported Stateflow machine parented data- Model data structures, including rtM- Model entry point functions•model_priva
The Build Process2-25• model.exe (on PC) or model (on UNIX), generated in current directory, not in build directoryExecutable program file created und
2 Building an Application2-26• model_dt.hC header file used for supporting External Mode. Declares structures that contain data type and data type tra
The Build Process2-27• Project directory—slprjA subdirectory within your working directory. When models referenced via Model blocks are built for simu
2 Building an Application2-28Shared Utilities Directory in the Build Process” in the Real-Time Workshop User’s Guide documentation.
The Build Process2-29
2 Building an Application2-30
3Working with Real-Time WorkshopThis chapter provides an overview of the ideas and technology behind Real-Time Workshop, and hands-on exercises to he
3 Working with Real-Time Workshop3-2Basic Real-Time Workshop ConceptsEven if you have experience in building real-time systems, you may find it helpfu
Basic Real-Time Workshop Concepts3-3Target and HostA target is an environment—hardware or operating system—on which your generated code will run. The
iv Contents
3 Working with Real-Time Workshop3-4The Generic Real-Time TargetReal-Time Workshop provides a generic real-time development target. The GRT target pro
Basic Real-Time Workshop Concepts3-5Template MakefilesReal-Time Workshop uses template makefiles to build an executable from the generated code. The R
3 Working with Real-Time Workshop3-64 Finally, make is invoked. make compiles and links a program from the generated code, as instructed in the genera
Quick Start Tutorials3-7Quick Start TutorialsThis section provides hands-on experience with the code generation, program building, data logging, code
3 Working with Real-Time Workshop3-8Compilers” on page 1-14 for more information on supported compilers and compiler installation.The f14 Demonstratio
Quick Start Tutorials3-9Tutorial 1: Building a Generic Real-Time ProgramThis tutorial walks through the process of generating C code and building an e
3 Working with Real-Time Workshop3-10Note When a model contains Model blocks (which enable one Simulink model to include others), special project dir
Quick Start Tutorials3-11Mode: SingleTaskingThe Solver pane with the modified parameter settings is shown below. Note the tan background color of the
3 Working with Real-Time Workshop3-12Selecting the Target ConfigurationNote The steps in this section do not require you to make changes. They are in
Quick Start Tutorials3-134 From the list of available configurations, select Generic Real-Time Target (as shown above) and then click OK.Note The Sys
1What Is Real-Time Workshop?This guide begins with a high-level overview of Real-Time Workshop®, describing its purpose, its component parts, its maj
3 Working with Real-Time Workshop3-145 Select the Debug tab of the Real-Time Workshop dialog. The options displayed here control build verbosity and d
Quick Start Tutorials3-156 Select the Symbols tab of the Real-Time Workshop dialog. The options on this pane control the look and feel of generated co
3 Working with Real-Time Workshop3-167 Select the Comments tab of the Real-Time Workshop dialog. The options displayed here control the types of comme
Quick Start Tutorials3-178 Make sure that the Generate code only option is not selected, and save the model.Building and Running the ProgramThe Real-T
3 Working with Real-Time Workshop3-18The content of many of the succeeding messages depends on your compiler and operating system. The final message i
Quick Start Tutorials3-19f14rtw_grt_rtw contains these generated source files:The build directory also contains other files used in the build process,
3 Working with Real-Time Workshop3-20To configure data logging, you use the Data Import/Export pane of the Configuration Parameters dialog. The proces
Quick Start Tutorials3-21enables Real-Time Workshop to generate code that logs the simulation time to the MAT-file with a related name, as you will se
3 Working with Real-Time Workshop3-228 Verify that the simulation time and outputs have been saved to the workspace.whos *out Name Size
Quick Start Tutorials3-23Part 2: Data Logging from Generated CodeIn the second part of the exercise, you build and run a Real-Time Workshop executable
1 What Is Real-Time Workshop?1-2Introducing Real-Time WorkshopReal-Time Workshop® is an extension of capabilities of Simulink® and MATLAB® that automa
3 Working with Real-Time Workshop3-244 Click Apply to register your changes.5 Generate code and build an executable: Click the Build button, type Ctrl
Quick Start Tutorials3-25Tutorial 3: Code VerificationIn this tutorial, you verify the answers computed by code generated from the f14rtw model by com
3 Working with Real-Time Workshop3-26The Stick Input signal to the scope block is logged to the array Stick_input during simulation. The generated cod
Quick Start Tutorials3-273 Use the whos command to observe that the array variables Stick_input, Pilot_G_force, and Angle_of_attack have been saved to
3 Working with Real-Time Workshop3-28!f14rtwThe executing program writes the following messages to the console.** starting the model ** ** created f14
Quick Start Tutorials3-29Comparing Numerical Results of the Simulation and the Generated ProgramYour Simulink simulations and the generated code shoul
3 Working with Real-Time Workshop3-30Tutorial 4: A First Look at Generated CodeIn this tutorial, you examine code generated from a simple model to obs
Quick Start Tutorials3-315 Click the Solver tab and enter the following parameter values on the Solver pane:Solver options: set Type to Fixed-step. Se
3 Working with Real-Time Workshop3-322 Click Apply.3 Click the Real-Time Workshop node and click the Generate code button.4 Because the Generate code
Quick Start Tutorials3-335 The generated code is in the build directory, example_grt_rtw. The file example_grt_rtw\example.c contains the output compu
Introducing Real-Time Workshop1-3embedded target products extend and tailor Real-Time Workshop code to run in a growing suite of microprocessor enviro
3 Working with Real-Time Workshop3-34 example_P.SineWave_Phase) + example_P.SineWave_Bias; example_B.gain_out = example_B.sin_out * example_P.Gain
Quick Start Tutorials3-35You will observe the effects of expression folding later in this tutorial. Not performing expression folding allows you to se
3 Working with Real-Time Workshop3-36 sin(example_P.SineWave_Freq * example_M->Timing.t[0] + example_P.SineWave_Phase) + example_P.SineWave_B
Quick Start Tutorials3-374 Click the Generate code button.5 As before, Real-Time Workshop generates code in the example_grt_rtw directory.6 Edit examp
3 Working with Real-Time Workshop3-38Enabling this option causes Real-Time Workshop to produce an HTML file for each generated source file, plus a sum
Quick Start Tutorials3-39you can navigate to identify the settings of every option in place at the time that the HTML report was generated.You can ref
3 Working with Real-Time Workshop3-40The example presented uses the generic real-time target, and does not require any hardware other than the compute
Quick Start Tutorials3-414 Define and assign two variables A and B in the MATLAB workspace as follows:A = 2; B = 3;5 Open Gain block A and set its Gai
3 Working with Real-Time Workshop3-428 From the File menu, choose Save As. Save the model as ext_example.mdl.Part 2: Building the Target ExecutableIn
Quick Start Tutorials3-432 Click the Data Import/Export tab, and clear the Time and Output check boxes. In this exercise, data is not logged to the wo
Lista Seiwa Sprzęt wodny produkty zawierają 22 instrukcje obsługi do modeli 14. Wszystkie podręczniki użytkownika w formacie pdf są dostępne do pobrania lub obejrzenia online.
Comentários a estes Manuais