MATLAB XPC TARGET 4 - API GUIDE User's Guide

Browse online or download User's Guide for Development software MATLAB XPC TARGET 4 - API GUIDE. MATLAB XPC TARGET 4 - API GUIDE User`s guide [en] User Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 372
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews

Summary of Contents

Page 1 - User’s Guide

User’s GuideVersion 2For Use with Real-Time Workshop®xPC Target

Page 2 - How to Contact The MathWorks:

vi Contents11xPC Target and FortranIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2Simulink Demos

Page 3

4 Embedded Option4-2IntroductionThe xPC Target Embedded Option allows you to boot the xPC Target kernel from a 3.5 inch disk drive and other devices,

Page 4

xPC Target Embedded Option Modes4-3xPC Target Embedded Option ModesThe xPC Target Embedded Option extends the xPC Target base product with two modes:

Page 5

4 Embedded Option4-4The following are some instances where you might want to use the xPC Target Embedded Option. You might have one of these situation

Page 6 - Embedded Option

xPC Target Embedded Option Modes4-5- autoexec.bat — xPC Target version of this file that calls the xpcboot.com executable to boot the xPC Target kerne

Page 7

4 Embedded Option4-6StandAlone Mode OverviewThe primary purpose of the StandAlone mode is to allow you to use a target PC as a stand-alone system. Sta

Page 8

xPC Target Embedded Option Modes4-7- xpcboot.com — Contains the xPC Target boot executable. This file executes an xPC Target application and executes

Page 9

4 Embedded Option4-8RestrictionsThe following restrictions apply to the booted DOS environment when you use xpcboot.com to execute the target applicat

Page 10 - Troubleshooting

Embedded Option Setup4-9Embedded Option SetupThis section includes the following topics:• “Updating the xPC Target Environment” on page 4-9 • “Creatin

Page 11 - Function Reference

4 Embedded Option4-10The default setting for the option Target boot mode is BootFloppy. When you are using BootFloppy, xPC Target must first create a

Page 12 - Contents

Embedded Option Setup4-11For more detailed information about how to use the xPC Target Explorer window, see “xPC Target Explorer” in Chapter 2 in the

Page 13 - Target and Scope Objects

vii14Function ReferenceFunctions — Categorical List . . . . . . . . . . . . . . . . . . . . . . . . . 14-2Software Environment . . . . . . . . . .

Page 14 - 1 Target and Scope Objects

4 Embedded Option4-12DOSLoader Target SetupDOSLoader mode allows you to copy the xPC Target kernel to the target flash disk, remove the 3.5 inch disk

Page 15 - Scope Objects

DOSLoader Target Setup4-135 Click Create BootDisk.A message box opens with the following message.Insert a formatted floppy disk into your host PC disk

Page 16

4 Embedded Option4-14c Reboot the target PC. The DOS is booted from the target boot disk and the autoexec.bat files, resulting in the automatic execut

Page 17

DOSLoader Target Setup4-154 Typecopy A:\xpcsgo1.rtb C:\workcopy A:\xpcboot.com C:\workcopy A:\autoexec.bat C:\work5 If you want the kernel to run when

Page 18

4 Embedded Option4-16Creating a Target Application for DOSLoader ModeFor DOSLoader mode, a target application is created on a host PC and downloaded t

Page 19 - MATLAB Interface

Stand-Alone Target Setup4-17Stand-Alone Target SetupStandAlone mode combines the target application with the kernel and boots them together on the tar

Page 20 - Working with Target Objects

4 Embedded Option4-185 From the Target boot mode list, choose StandAlone.xPC Target updates the environment properties, and the build process is ready

Page 21 - Deleting Target Objects

Stand-Alone Target Setup4-192 Edit the Scope (xPC) dialog box and confirm that the check box entry for Start scope when application starts is selected

Page 22 - 2 Alternatively, you can type

4 Embedded Option4-20This setting is required to enable target scopes to begin operating as soon as the application starts running. This setting is im

Page 23

Stand-Alone Target Setup4-21Creating a Kernel/Target ApplicationUse xPC Target with StandAlone mode to create a combined kernel and target application

Page 24

viii Contents

Page 25 - Working with Scope Objects

4 Embedded Option4-22c Reboot the target PC. DOS is booted from the target boot disk and the autoexec.bat files, resulting in the automatic execution

Page 26 - 2 Alternatively, type

Stand-Alone Target Setup4-236 Edit the file C:\autoexec.bat to include the following lines. Adding these commands to C:\autoexec.bat directs the syste

Page 27

4 Embedded Option4-24

Page 28

5Software Environment and DemosThe xPC Target environment defines the connections and communication between the host and target computers. It also de

Page 29

5 Software Environment and Demos5-2Using Environment Properties and FunctionsUse the xPC Target Explorer window or the MATLAB Command Window to enter

Page 30

Using Environment Properties and Functions5-3Changing Environment Properties with xPC Target ExplorerxPC Target lets you define and change environment

Page 31

5 Software Environment and Demos5-4This pane contains all the objects in your xPC Target hierarchy. As you add objects to your system, xPC Target Expl

Page 32

Using Environment Properties and Functions5-5Note In general, the default values of these parameters are sufficient for you to use xPC Target.1 In th

Page 33

5 Software Environment and Demos5-67 From the Target scope list, select either Enabled or Disabled. The property Target scope is set by default to Ena

Page 34

Using Environment Properties and Functions5-72 In the MATLAB window, typeupdatexpcenvThe environment properties you changed with the function setxpcen

Page 35

1Target and Scope ObjectsBefore you can work with xPC Target target and scope objects, you should understand the concept of target and scope objects.

Page 36

5 Software Environment and Demos5-8xPC Target DemosThe xPC Target demos are used to demonstrate the features of xPC Target. But they are also M-file s

Page 37 - Signals and Parameters

6Using the Target PC Command-Line InterfaceYou can interact with the xPC Target environment through the target PC command window. xPC Target provides

Page 38 - 3 Signals and Parameters

6 Using the Target PC Command-Line Interface6-2Target PC Command-Line InterfaceThis interface is useful with stand-alone applications that are not con

Page 39 - Monitoring Signals

Target PC Command-Line Interface6-3Once the command window is active, you do not have to reactivate it before typing the next command. Manipulating Ta

Page 40

6 Using the Target PC Command-Line Interface6-4The command window displays a message to indicate that the new parameter has registered.System: S0 has

Page 41

Target PC Command-Line Interface6-52 Type a scope command. For example, to add a target scope (scope 2) in the model xpcosc, typeaddscope 2xPC Target

Page 42

6 Using the Target PC Command-Line Interface6-6Manipulating Scope Object Properties from the Target PCThis section shows some of the common tasks that

Page 43

Target PC Command-Line Interface6-72 Type the variable name to run that command sequence. For example, to turn the motor on, typeonThe parameter P7 is

Page 44

6 Using the Target PC Command-Line Interface6-8

Page 45

7Working with Target PC Files and File SystemsxPC Target scopes of type file create files on the target PC. To work with these files from the host PC

Page 46

1 Target and Scope Objects1-2Target ObjectsxPC Target uses a target object (of class xpctarget.xpc) to represent the target kernel and your target app

Page 47 - Signal Tracing

7 Working with Target PC Files and File Systems7-2IntroductionThe xPC Target scope object of type file always writes acquired signal data to a file on

Page 48

Introduction7-3This chapter describes procedures on how to use the xpctarget.ftp and xpctarget.fs methods for common operations. See Chapter 14, “Func

Page 49 - Add Target Scope

7 Working with Target PC Files and File Systems7-4FTP and File System ObjectsxPC Target uses two objects, xpctarget.ftp and xpctarget.fs (file system)

Page 50

Using xpctarget.ftp Objects7-5Using xpctarget.ftp ObjectsThe xpctarget.ftp object enables you to work with any file on the target PC, including the da

Page 51

7 Working with Target PC Files and File Systems7-6For example, to list the name of the current directory of a target PC through a TCP/IP connection,1

Page 52

Using xpctarget.ftp Objects7-7Note You must use the dir(f) syntax to list the contents of the directory. To get the results in an M-by-1 structure, u

Page 53 - Add to Scopes

7 Working with Target PC Files and File Systems7-82 Typef.get('data.dat');This retrieves the file and saves that file to the variable data.

Page 54

Using xpctarget.fs Objects7-9Using xpctarget.fs ObjectsThe fs object enables you to work with the target PC file system. The fs object has methods tha

Page 55

7 Working with Target PC Files and File Systems7-10• “Getting Information about a File on the Target PC” on page 7-15• “Getting Information about a Di

Page 56

Using xpctarget.fs Objects7-111 In the MATLAB window, type a command like the following to assign the xpctarget.fs object to a variable.fsys=xpctarget

Page 57 - Software Triggering Scopes

Scope Objects1-3Scope ObjectsxPC Target uses scope objects to represent scopes on the target PC. Use scope object functions to view and collect signal

Page 58

7 Working with Target PC Files and File Systems7-12data2=fread(fsys,h);This reads the file data.dat and stores the contents of the file to data2. This

Page 59

Using xpctarget.fs Objects7-13If you are using xPC Target in StandAlone mode, you can extract the data from the data file if you know the number of si

Page 60

7 Working with Target PC Files and File Systems7-14Getting a List of Open Files on the Target PCYou can get a list of open files on the target PC file

Page 61

Using xpctarget.fs Objects7-15Getting Information about a File on the Target PCYou can display information for a file on the target PC file system fro

Page 62

7 Working with Target PC Files and File Systems7-16Use the method syntax to run an xpctarget.fs object method. The syntax method_name(fs_object, argum

Page 63

8Graphical User InterfacesYou can run and test your target application using the MATLAB command-line interface or the Simulink block diagram for your

Page 64

8 Graphical User Interfaces8-2xPC Target Interface Blocks to Simulink ModelsYou can use Simulink to create a custom graphical user interface (GUI) for

Page 65

xPC Target Interface Blocks to Simulink Models8-3Altia Design — Altia also provides Simulink blocks that communicate with xPC Target interface blocks.

Page 66

8 Graphical User Interfaces8-45 To the user interface template model, add Simulink interface blocks from add-on products (Virtual Reality Toolbox, Alt

Page 67

xPC Target Interface Blocks to Simulink Models8-5To xPC Target BlockThis block behaves as a sink and usually receives its input data from a control de

Page 68

1 Target and Scope Objects1-4A scope object on the host PC represents a scope on the target PC. You use scope objects to observe the signals from your

Page 69 - Scope of Type Target

8 Graphical User Interfaces8-6Note The use of To xPC Target blocks require a connection between the host and target PC. If there is no connection bet

Page 70

xPC Target Interface Blocks to Simulink Models8-7xpclib/Misc sublibrary. See “From xPC Target” on page 34-10 in the xPC Target I/O reference documenta

Page 71 - Interrupted) or finishes

8 Graphical User Interfaces8-8Creating a Target Application ModelA target application model is a Simulink model that describes your physical system, a

Page 72

xPC Target Interface Blocks to Simulink Models8-94 In the Description box, delete the existing tag and enter a tag to the parameters for this block.Fo

Page 73

8 Graphical User Interfaces8-10For the PumpSwitch and ValveSwitch blocks, enter the following tags respectively:xPCTag(2)=pump_switch;xPCTag(1)=drain_

Page 74

xPC Target Interface Blocks to Simulink Models8-11Note that you cannot select signals on the output ports of any virtual blocks such as Subsystem and

Page 75 - Signal logging

8 Graphical User Interfaces8-12The tag has the following format syntax:xPCTag(1, . . . index_n)=label_1 . . . label_n;For single dimension ports, the

Page 76

xPC Target Interface Blocks to Simulink Models8-13xPCTag(2,4)=label_1 label_2;6 From the File menu, click Save as. Enter a filename for your model. Fo

Page 77

8 Graphical User Interfaces8-14

Page 78

9xPC Target Web Browser InterfacexPC Target has a Web server that allows you to interact with your target application through a Web browser. You can

Page 79

Scope Objects1-5The xpcschost scope object of type host has the following object properties:•Data• StartTime• TimeThe xpcfs scope object of type file

Page 80

9 xPC Target Web Browser Interface9-2Web Browser InterfacexPC Target has a Web server built into the kernel that allows you to interact with your targ

Page 81 - Enter key

Web Browser Interface9-31 In the MATLAB window, typexpcwwwenableMATLAB is disconnected from the target PC, and the connection is reset for connecting

Page 82

9 xPC Target Web Browser Interface9-42 Open a DOS command window, and enter the command to start the TCP/IP to RS-232 gateway. For example, if the tar

Page 83 - Parameter Tuning with MATLAB

Web Browser Interface9-56 In the MATLAB Command Window, typexpcMATLAB reconnects to the target application and lists the properties of the target obje

Page 84

9 xPC Target Web Browser Interface9-6Using the Main PaneThe Main pane is divided into four parts, one below the other. The four parts are System Statu

Page 85

Web Browser Interface9-7After you connect a Web browser to the target PC, you can use the Main pane to control the target application:

Page 86

9 xPC Target Web Browser Interface9-81 In the left frame, click the Refresh button.System status information in the top cell is uploaded from the targ

Page 87 - Connect to target

Web Browser Interface9-9The new property values are downloaded to the target application. Note that the SampleTime box is visible only when the target

Page 88

9 xPC Target Web Browser Interface9-102 In the Refresh Interval box, enter a value greater than 10. For example, enter 20.The signal pane updates auto

Page 89

Web Browser Interface9-11Viewing Parameters with a Web BrowserThe Parameters pane displays a list of all the tunable parameters in your model. Row and

Page 90

1 Target and Scope Objects1-6

Page 91

9 xPC Target Web Browser Interface9-123 In the Target selection section, access levels are set in the RTW system target file box. For example, to set

Page 92

10Interrupts Versus PollingxPC Target interrupt mode is the default real-time execution mode for the xPC Target kernel. For performance reasons, you

Page 93 - Add to table

10 Interrupts Versus Polling10-2Polling ModeA good understanding of polling mode will help you to use it effectively, and a better understanding of in

Page 94

Polling Mode10-3Additionally, background tasks like host-target communication or updating the target screen run in parallel with sample-time-based mod

Page 95 - Update Parameter button

10 Interrupts Versus Polling10-4• Interrupt handler entry and exit latency — Because an interrupt can stop the currently executing task at any instruc

Page 96

Polling Mode10-5Polling means that the kernel waits in an empty while loop until the time at which the next model step has to be executed is reached.

Page 97

10 Interrupts Versus Polling10-6• The model is optimal concerning execution speed — First, you should run the model through the Simulink profiler to f

Page 98

Polling Mode10-71 In the Simulink window, and from the Tools menu, point to Real-Time Workshop, and then click Options.The Configuration Parameters di

Page 99

10 Interrupts Versus Polling10-8displays the CPU clock rate in MHz right after the target PC has been powered up.For example, if your target PC is a 1

Page 100 - 4 Embedded Option

Polling Mode10-9Restrictions Introduced by Polling ModeAs explained above, polling mode executes the Simulink-based target application in real time ex

Page 101

2Targets and Scopes in the MATLAB InterfaceYou can work with xPC Target target and scope objects through the MATLAB interface (MATLAB Command Window)

Page 102

10 Interrupts Versus Polling10-10If the target application execution finally reaches the stop time and polling mode execution is stopped, host-target

Page 103 - 9 Boot the target PC

Polling Mode10-11• Signal tracing through scope objects — Neither through scope objects of type host (xPC Target Explorer or scripts) or type target (

Page 104

10 Interrupts Versus Polling10-12I/O Drivers Using Kernel Timing Information Cannot Be Used Within a ModelSome xPC Target drivers use timing informati

Page 105 - *.rtb file

Polling Mode10-13Generally, you can use the same software/hardware setup for passing other information back and forth during run time of the target ap

Page 106

10 Interrupts Versus Polling10-14

Page 107 - Embedded Option Setup

11xPC Target and FortranxPC Target supports the incorporation of Fortran code into Simulink models. This chapter describes the following:Introduction

Page 108

11 xPC Target and Fortran11-2IntroductionxPC Target supports Fortran in Simulink models with S-functions. (See “Creating Fortran S-Functions” in the w

Page 109 - Creating a DOS System Disk

Introduction11-35 Double-click the Fortran S-functions block. A library of Fortran S-functions and associated templates appears. This library also con

Page 110

11 xPC Target and Fortran11-46 Define the Fortran libraries, and the Fortran object files from step 1, in the Real-Time Workshop dialog of the Simulin

Page 111 - DOSLoader Target Setup

Step-by-Step Example of Fortran and xPC Target11-5Step-by-Step Example of Fortran and xPC TargetThis example uses the demo Atmosphere model that comes

Page 112

How to Contact The MathWorks:www.mathworks.com Webcomp.soft-sys.matlab [email protected] Technical [email protected] Product

Page 113 - Reset button on your target

2 Targets and Scopes in the MATLAB Interface2-2Working with Target ObjectsThis topic describes how to work with target objects using target object fun

Page 114

11 xPC Target and Fortran11-64 Connect this Scope block to the Tamb, K signal.The model sfcndemo_atmos.mdl should look like the figure shown.5 Double-

Page 115 - Stand-Alone Target Setup

Step-by-Step Example of Fortran and xPC Target11-7Compiling Fortran FilesThis section describes the ways that you can compile Fortran code for xPC Tar

Page 116

11 xPC Target and Fortran11-83 Typefl32 -c /iface:cref -G5 -Ox -Zi sfun_atmos_sub.fThis command generates the sfun_atmos_sub.obj file.Of these options

Page 117

Step-by-Step Example of Fortran and xPC Target11-9Creating a C-MEX Wrapper S-FunctionThis section assumes that you have compiled your Fortran code. Se

Page 118

11 xPC Target and Fortran11-10Invoking the mex command includes the following steps:1 Compile the wrapper C file sfun_atmos.c. Be sure to link in the

Page 119

Step-by-Step Example of Fortran and xPC Target11-111 At the MATLAB window, typefortran_atmos_xpcThis opens the Simulink model associated with the Atmo

Page 120

11 xPC Target and Fortran11-123 In the left pane, click the Real-Time Workshop node.The Real-Time Workshop pane opens.4 In the Target selection sectio

Page 121

Step-by-Step Example of Fortran and xPC Target11-13Building and Running the xPC Target ApplicationThis section assumes that you have prepared the mode

Page 122

11 xPC Target and Fortran11-14

Page 123 - Software Environment

12TroubleshootingThis chapter describes guidelines, hints, and tips for issues you might encounter while using xPC Target. Refer to The MathWorks Sup

Page 124 - 1 In the MATLAB window, type

Working with Target Objects2-3To check a connection between a host and a target, use the target function targetping. For example,tg.targetpingNote To

Page 125 - Explorer

12 Troubleshooting12-2General Troubleshooting Hints and TipsThis section lists general troubleshooting tips that you can use as a first attempt to res

Page 126

General Troubleshooting Hints and Tips12-3• Verify that the xPC Target boot disk contains files like the following:-BOOTSECT.RTT- checksum.dat- XPCTGB

Page 127

12 Troubleshooting12-4The xpctest command performs a series of tests on your xPC Target system. These tests range from performing a basic communicatio

Page 128 - Command-Line Interface

General Troubleshooting Hints and Tips12-5• USB support — Disable all USB support, including general USB and USB keyboard support. Failure to do this

Page 129 - In the MATLAB window, type

12 Troubleshooting12-6Refer to The MathWorks Support Web SiteThis chapter contains general xPC Target troubleshooting tips. Refer to the MathWorks Sup

Page 130

Installation, Configuration, and Test Troubleshooting12-7Installation, Configuration, and Test TroubleshootingThe following are some issues you might

Page 131 - Using the Target PC

12 Troubleshooting12-8xpctest: Test 2 Fails. First, follow the procedure described in the “Test 2, Ping Target System xPC Target Ping” section of the

Page 132 - C. In this case

Installation, Configuration, and Test Troubleshooting12-9xpctest norebootThis command runs the test without trying to reboot the target PC. It display

Page 133 - Target PC

12 Troubleshooting12-10Error executing build command: Error using ==> make_rtwError using ==> rtw_cErrors encountered while building model "

Page 134 - System: S0 has value 5.1851

Installation, Configuration, and Test Troubleshooting12-11xpctest: Test 5 Fails. This error occurs only when the environment variable settings are out

Page 135

2 Targets and Scopes in the MATLAB Interface2-41 In the MATLAB window, typetgThe current target application properties are uploaded to the host PC, an

Page 136

12 Troubleshooting12-12xpctest: Test 6 Fails. This test runs the basic target object constructor, xpc. This error rarely occurs without an earlier tes

Page 137

Installation, Configuration, and Test Troubleshooting12-13• There is a known issue with an earlier version of xPC Target (1.3). It might occur when yo

Page 138

12 Troubleshooting12-14Advanced TroubleshootingThe following are some advanced issues or questions you might have with xPC Target. This section has th

Page 139 - Files and File Systems

Advanced Troubleshooting12-15General I/O Troubleshooting GuidelinesIf you encounter issues using the xPC Target I/O drivers,• Ensure that you have pro

Page 140 - Introduction

12 Troubleshooting12-16When this error occurs, the target object property CPUoverload changes from none to detected. To correct the issue, perform one

Page 141

Advanced Troubleshooting12-17More Help. If the preceding procedures do not resolve the issue, if you can build a target application with the CAN board

Page 142 - FTP and File System Objects

12 Troubleshooting12-18Note You can also obtain PCI device information from xPC Target Explorer. To do so, in xPC Target Explorer, select a connected

Page 143 - Using xpctarget.ftp Objects

Advanced Troubleshooting12-19• The referenced xPC Target driver has an issue.xPC Target I/O Boards with Slow Initialization Times. Some xPC Target boa

Page 144

12 Troubleshooting12-20In this case, the host PC waits for about 20 seconds before declaring that a time-out has occurred. Note that it does not take

Page 145

Advanced Troubleshooting12-21However, hardware does not allow infinite precision in setting the spacing between the timer interrupts. It is this limit

Page 146

Working with Target Objects2-5To get a list of the writable properties, type set(target_object). The build process assigns the default name of the tar

Page 147 - Using xpctarget.fs Objects

12 Troubleshooting12-22Round this number to the nearest whole number of 117 ticks. The resulting frequency is then(116.96 ticks/117)(50) = 49.983 HzTh

Page 148

Advanced Troubleshooting12-23• http://www.mathworks.com/support/solutions/data/31528.html• Existing xPC Target device driver source code. Refer to the

Page 149

12 Troubleshooting12-24Can I Create a Stand-Alone xPC Target Application to Interact with a Target Application?Yes. You can use either the xPC Target

Page 150

Advanced Troubleshooting12-25For example, if a model has a stop time of 2.4 and a step size of 1, Real-Time Workshop adjusts the stop time of the mode

Page 151

12 Troubleshooting12-26

Page 152

13Target PC Command-Line Interface ReferencexPC Target provides a limited set of commands that you can use to work the target application after it ha

Page 153

13 Target PC Command-Line Interface Reference13-2Target PC CommandsThe target PC command-line interface enables you to work with target and scope obje

Page 154

Target PC Commands13-3Target Object MethodsWhen you are using the target PC command-line interface, target object methods are limited to starting and

Page 155 - Graphical User Interfaces

13 Target PC Command-Line Interface Reference13-4 Target PC CommandDescription and Syntax MATLAB EquivalentgetparDisplay the value of a block paramete

Page 156 - 8 Graphical User Interfaces

Target PC Commands13-5Scope Object MethodsWhen using the target PC command-line interface, you use scope object methods to start a scope and add signa

Page 157 - Host PC Target PC

2 Targets and Scopes in the MATLAB Interface2-6Using the Method Syntax with Target ObjectsUse the method syntax to run a target object method. The syn

Page 158

13 Target PC Command-Line Interface Reference13-6The following table lists the syntax for the target commands that you can use on the target PC. The M

Page 159 - To xPC Target Block

Target PC Commands13-7ylimitylimit scope_indexylimit scope_index = autoylimit scope_index = num1, num2grid grid scope_index ongrid scope_index offTarg

Page 160

13 Target PC Command-Line Interface Reference13-8Scope Object Property CommandsWhen you use the target PC command-line interface, scope object propert

Page 161 - Block Parameters

Target PC Commands13-9triggerslope scope_index = 0, either, 1, rising, 2, fallingsc.TriggerSlope = 'Either', 'Rising', 'Falli

Page 162

13 Target PC Command-Line Interface Reference13-10Aliasing with Variable CommandsThe following table lists the syntax for the aliasing variable comman

Page 163

14Function Reference

Page 164

14 Function Reference14-2Functions — Categorical ListThis topic contains reference pages for xPC Target functions.Software Environment“Software Enviro

Page 165 - Documentation tab

Functions — Categorical List14-3GUITestTarget ObjectsThe target object methods allow you to control a target application on the target PC from the hos

Page 166

14 Function Reference14-4start (target object) Start execution of target application on target PCstop (target object) Stop execution of target applica

Page 167

Functions — Categorical List14-5Scope ObjectsThe scope object methods allow you to control scopes on your target PC. If you want to control the target

Page 168

Working with Scope Objects2-7Working with Scope ObjectsThis topic describes how to work with scope objects using scope object functions.• “Displaying

Page 169 - Interface

14 Function Reference14-6File and File System ObjectsxPC Target uses the xpctarget.ftp object to represent a target PC file, such as a signal data fil

Page 170 - Web Browser Interface

Functions — Categorical List14-7xpctarget.ftp FunctionsThe xpctarget.ftp methods allow you to work with a target PC file, such as a signal data file,

Page 171

14 14-8Functions — Alphabetical List 14This section contains function reference pages listed alphabetically.

Page 172 - Ctrl+C is not used to

addscope14-914addscopePurpose Create one or more scopesSyntax MATLAB command lineCreate a scope and scope object without assigning to a MATLAB variabl

Page 173

addscope14-10A scope acquires data from the target application and displays that data on the target PC, uploads the data to the host PC, or stores tha

Page 174 - Using the Main Pane

addscope14-11sc1 = getscope(tg,1) or sc1 = tg.getscope(1)Create two scopes using a vector of scope objects scvector. Two target scopes are created on

Page 175 - Main pane

addsignal14-1214addsignalPurpose Add signals to a scope represented by a scope objectSyntax MATLAB command lineaddsignal(scope_object_vector, signal_i

Page 176

addsignal14-13Signals = 1 : Signal Generator 0 : Integrator1Another way to add signals without using the method a

Page 177 - Changing WWW Properties

cd14-1414cdPurpose Change directory on target PCSyntax MATLAB command line cd(file_obj,target_PC_dir)file_obj.cd(target_PC_dir)Arguments Description

Page 178 - -1 or Inf

close14-1514closePurpose Close serial port connecting host PC with target PCSyntax MATLAB command lineclose(target_object)target_object.closeArguments

Page 179

2 Targets and Scopes in the MATLAB Interface2-8For a list of target object properties with a description, see the target function get (target object)

Page 180 - 1, enter

delete14-1614deletePurpose Remove target objectSyntax MATLAB command linedelete(target_object)target_object.deleteArguments Description Use this meth

Page 181 - Interrupts Versus Polling

dir14-1714dirPurpose List contents of current directory on target PCSyntax MATLAB command linedir(file_obj)Arguments Description Method of xpctarget.

Page 182 - 10 Interrupts Versus Polling

dir14-18 11/2/2003 13:54 6 MSDOS SYS 11/5/1998 20:01 93880 COMMAND COM 11/2/2003 13:54 <DIR> 0

Page 183 - Polling Mode

diskinfo14-1914diskinfoPurpose Get information about target PC driveSyntax MATLAB command line diskinfo(filesys_obj,target_PC_drive)filesys_obj.diskin

Page 184

fclose14-2014fclosePurpose Close one or more open target PC filesSyntax MATLAB command line fclose(filesys_obj,file_ID)filesys_obj.fclose(file_ID)Argu

Page 185

fc422mexcalcbits14-2114fc422mexcalcbitsPurpose Calculate parameter values for Fastcom 422/2-PCI boardSyntax MATLAB command line [a b ] = fc422mexcalcb

Page 186

fileinfo14-2214fileinfoPurpose Get target PC file informationSyntax MATLAB command line fileinfo(filesys_obj,file_ID)filesys_obj.fileinfo(file_ID)Argu

Page 187

filetable14-2314filetablePurpose Get information about open files in target PC file systemSyntax MATLAB command line filetable(filesys_obj)filesys_obj

Page 188

fopen14-2414fopenPurpose Open target PC file for readingSyntax MATLAB command line file_ID = fopen(file_obj,'file_name')file_ID = file_obj.f

Page 189 - Target Application

fread14-2514freadPurpose Read open target PC fileSyntax MATLAB command line fread(file_obj,file_ID)file_obj.fread(file_ID)Arguments Description Metho

Page 190

Working with Scope Objects2-92 Alternatively, you can typeset(sc1,'triggermode', 'signal') or typesc1.set('triggermode',

Page 191

fwrite14-2614fwritePurpose Write binary data to the open target PC fileSyntax MATLAB command line fwrite(file_obj,file_ID,A)file_obj.fwrite(file_ID,A)

Page 192

get (ftp)14-2714get (ftp)Purpose Retrieve copy of requested file from target PCSyntax MATLAB command lineget(file_obj,file_name)file_obj.get(file_name

Page 193 - Polling Mode Performance

get (scope object)14-2814get (scope object)Purpose Return property values for scope objectsSyntax MATLAB command lineget(scope_object_vector)get(scope

Page 194

get (scope object)14-29The properties for a scope object are listed in the following table. This table includes descriptions of the properties and the

Page 195

get (scope object)14-30Filename Provide a name for the file to contain the signal data. By default, the target PC writes the signal data to a file nam

Page 196 - 11 xPC Target and Fortran

get (scope object)14-31ModeFor scopes of type 'Target', indicate how a scope displays the signals. Values are 'Numerical', 'R

Page 197 - Prerequisites

get (scope object)14-32NumSamplesNumber of contiguous samples captured during the acquisition of a data package. If the scope stops before capturing t

Page 198

get (scope object)14-33StatusIndicate whether data is being acquired, the scope is waiting for a trigger, the scope has been stopped (interrupted), or

Page 199

get (scope object)14-34TriggerSampleIf TriggerMode is 'Scope', then TriggerSample specifies which sample of the triggering scope the current

Page 200

get (scope object)14-35Examples List all the readable properties, along with their current values. This is given in the form of a structure whose fiel

Page 201 - Compiling Fortran Files

2 Targets and Scopes in the MATLAB Interface2-102 Alternatively, you can typebeginrun = get(sc1,'starttime') or typesc1.get('starttime&

Page 202

get (scope object)14-36List the value for the scope object property Type. Notice that the property name is a string, in quotation marks, and is not ca

Page 203

get (target object)14-3714get (target object)Purpose Return target object property values Syntax MATLAB command lineget(target_object, 'target_ob

Page 204

get (target object)14-38ExecTimeExecution time. Time, in seconds, since your target application started running. When the target application stops, th

Page 205 - Parameters

get (target object)14-39ModeType of Real-Time Workshop code generation. Values are 'Real-Time Singletasking', 'Real-Time Multitasking&a

Page 206

get (target object)14-40ParametersList of tunable parameters. This list is visible only when ShowParameters is set to 'on':• Property value.

Page 207

get (target object)14-41SignalsList of viewable signals. This list is visible only when ShowSignals is set to 'on'.• Property name. S0, S1.

Page 208

get (target object)14-42Examples List the value for the target object property StopTime. Notice that the property name is a string, in quotation marks

Page 209

getfilesize14-4314getfilesizePurpose Get size of file on target PCSyntax MATLAB command line getfilesize(file_obj,file_ID)file_obj.getfilesize(file_ID

Page 210 - 12 Troubleshooting

getlog14-4414getlogPurpose Get all or part of output logs from target objectSyntax MATLAB command linelog = getlog(target_object, 'log_name'

Page 211 - Is the Target PC Halted?

getparam14-4514getparamPurpose Return value of target object parameter indexSyntax MATLAB command linegetparam(target_object, parameter_index)Argument

Page 212

Working with Scope Objects2-111 In the MATLAB window, typeallscopes(1).addsignal([0,1]) 2 Alternatively, you can typeaddsignal(allscopes(1), [0,1])Acq

Page 213

getparamid14-4614getparamidPurpose Get parameter index from parameter listSyntax MATLAB command linegetparamid(target_object, 'block_name',

Page 214

getparamname14-4714getparamnamePurpose Get block path and parameter name from index listSyntax MATLAB command linegetparamname(target_object, paramete

Page 215

getscope14-4814getscopePurpose Get scope object pointing to scope defined in kernelSyntax MATLAB command linescope _object_vector = getscope(target_ob

Page 216

getscope14-49The following example gets the properties of all scopes on the target PC and creates a vector of scope objects on the host PC. If the tar

Page 217

getsignal14-5014getsignalPurpose Return value of target object signal indexSyntax MATLAB command linegetsignal(target_object, 'signal index'

Page 218

getsignalid14-5114getsignalidPurpose Get signal index or signal property from signal listSyntax MATLAB command linegetsignalid(target_object, 'si

Page 219 - Create Bootdisk

getsignalname14-5214getsignalnamePurpose Get signal name from index listSyntax MATLAB command linegetsignalname(target_object, signal_index)Arguments

Page 220

getxpcenv14-5314getxpcenvPurpose List environment properties assigned to MATLAB variableSyntax MATLAB Command LinegetxpcenvDescription Function to lis

Page 221

getxpcenv14-54TargetRAMSizeMBValues are 'Auto' and 'Manual'. From the xPC Target Explorer window Target RAM size list, select eith

Page 222

getxpcenv14-55HostTargetCommValues are 'RS232' and 'TcpIp'. From the xPC Target Explorer window Host target communication list, se

Page 223 - Advanced Troubleshooting

Printing History: September 1999 First printing New for Version 1 (Release 11.1)November 2000 Online only Revised for Version 1.1 (Release 12)June 200

Page 224

2 Targets and Scopes in the MATLAB Interface2-12• Freerun — Starts to acquire data as soon as the scope is started (default)•Software — Starts to acqu

Page 225 - PCI Slot parameter of

getxpcenv14-56TcpIpTargetPortValue is 'xxxxx'.In the xPC Target Explorer window TcpIp target port box, enter a value greater than 20000. Thi

Page 226

getxpcenv14-57TcpIpTargetDriverValues are 'NE2000', 'SMC91C9X', 'I82559', and 'RTLANCE'.From the xPC Target Ex

Page 227

getxpcenv14-58TcpIpTargetISAMemPortValue is '0xnnnn'.If you are using an ISA bus Ethernet card, you must enter values for the properties Tcp

Page 228

getxpcenv14-59TargetScopeValues are 'Disabled' and 'Enabled'. From the xPC Target Explorer window Enable target scope list, select

Page 229

getxpcenv14-60Examples Return the xPC Target environment in the structure shown below. The output in the MATLAB window is suppressed. The structure co

Page 230

getxpcpci14-6114getxpcpciPurpose Determine which PCI boards are installed in target PCSyntax MATLAB Command Linegetxpcpci(target_object, 'type_of

Page 231

getxpcpci14-62getxpcpci('all')Display a list of the currently supported PCI devices in the xPC Target block library. The result is displayed

Page 232

load14-6314loadPurpose Download target application to target PCSyntax MATLAB command lineload(target_object,'target_application')target_obje

Page 233

loadparamset14-6414loadparamsetPurpose Restore parameter values saved in specified fileSyntax MATLAB command lineloadparamset(target_object,'file

Page 234

mkdir14-6514mkdirPurpose Make a directory on target PCSyntax MATLAB command line mkdir(file_obj,dir_name)file_obj.mkdir(dir_name)Arguments Descriptio

Page 235 - Interface Reference

Working with Scope Objects2-13• “Triggering One Scope with Another Scope to Acquire Data” on page 2-13 — Describes a configuration of one scope to tri

Page 236 - Target PC Commands

put14-6614putPurpose Copy file from host PC to target PCSyntax MATLAB command lineput(file_obj,file_name)file_obj.put(file_name)Arguments Description

Page 237 - Target Object Methods

pwd14-6714pwdPurpose Retrieve current directory path of target PCSyntax MATLAB command linepwd(file_obj)file_obj.pwdArguments Description Method of x

Page 238

reboot14-6814rebootPurpose Reboot target PCSyntax MATLAB command linereboot(target_object)Target PC command linerebootArguments Description reboot re

Page 239 - Scope Object Methods

remscope14-6914remscopePurpose Remove scope from target PCSyntax MATLAB command lineremscope(target_object, scope_number_vector)target_object.remscope

Page 240

remscope14-70Examples Remove a single scope.remscope(tg,1) or tg.remscope(1)Remove two scopes.remscope(tg,[1 2]) or tg.remscope([1,2])Remove all scope

Page 241

removefile14-7114removefilePurpose Remove file from target PCSyntax MATLAB command lineremovefile(file_obj,file_name)file_obj.removefile(file_name)Arg

Page 242

remsignal14-7214remsignalPurpose Remove signals from a scope represented by a scope objectSyntax MATLAB command lineremsignal(scope_object)remsignal(s

Page 243 - or move mouse

remsignal14-73See Also The xPC Target scope object method remsignal and the target object method getsignalid.

Page 244

rmdir14-7414rmdirPurpose Remove directory from target PCSyntax MATLAB command linermdir(file_obj,dir_name)file_obj.rmdir(dir_name)Arguments Descripti

Page 245

saveparamset14-7514saveparamsetPurpose Save current target application parameter valuesSyntax MATLAB command linesaveparamset(target_object,'file

Page 246 - 14 Function Reference

2 Targets and Scopes in the MATLAB Interface2-14• For Scope 2, set the following values:-sc(2).ScopeId = 2- sc(2).TriggerMode = 'Scope'- sc(

Page 247 - Target Objects

set (scope object)14-7614set (scope object)Purpose Change property values for scope objectsSyntax MATLAB command lineset(scope_object_vector)set(scope

Page 248

set (scope object)14-77The properties for a scope object are listed in the following table. This table includes descriptions of the properties and the

Page 249

set (scope object)14-78Filename Provide a name for the file to contain the signal data. By default, the target PC writes the signal data to a file nam

Page 250

set (scope object)14-79ModeFor scopes of type 'Target', indicate how a scope displays the signals. Values are 'Numerical', 'R

Page 251 - Functions — Categorical List

set (scope object)14-80NumSamplesNumber of contiguous samples captured during the acquisition of a data package. If the scope stops before capturing t

Page 252

set (scope object)14-81StatusIndicate whether data is being acquired, the scope is waiting for a trigger, the scope has been stopped (interrupted), or

Page 253 - Arguments

set (scope object)14-82TriggerSampleIf TriggerMode is 'Scope', then TriggerSample specifies which sample of the triggering scope the current

Page 254

set (scope object)14-83Examples Get a list of writable properties for a scope object.sc1 = getscope(tg,1)set(sc1)ans=TriggerSlopeIf TriggerMode is &ap

Page 255

set (scope object)14-84 NumSamples: {} Decimation: {} TriggerMode: {5x1 cell} TriggerSignal: {} TriggerLevel: {}

Page 256

set (target object)14-8514set (target object)Purpose Change target object property valuesSyntax MATLAB command lineset(target_object)set(target_object

Page 257

Working with Scope Objects2-15Posttriggering (P>0)Scope 1 triggers Scope 2 after the trigger event occurs. The following describes some of the ways

Page 258 - MATLAB command line

set (target object)14-86Properties must be entered in pairs or, using the alternate syntax, as one-dimensional cell arrays of the same size. This mean

Page 259

set (target object)14-87The function set typically does not return a value. However, if called with an explicit return argument, for example, a = set(

Page 260 - Purpose Remove target object

set (target object)14-88See Also xPC Target target object method get (target object).Scope object methods get (scope object) and set (scope object). B

Page 261

setparam14-8914setparamPurpose Change writable target object parametersSyntax MATLAB command linesetparam(target_object, 'parameter_value')A

Page 262 - function

setxpcenv14-9014setxpcenvPurpose Change xPC Target environment propertiesSyntax MATLAB Command Linesetxpcenv('property_name', 'property

Page 263

setxpcenv14-91CompilerPathValue is a valid compiler root directory. Enter the path where you installed a Watcom C/C++ or Microsoft Visual C/C++ compil

Page 264

setxpcenv14-92MaxModelSizeValues are '1MB', '4MB', and '16MB'. From the xPC Target Explorer window Maximum model size li

Page 265 - 14fc422mexcalcbits

setxpcenv14-93RS232BaudrateValues are '115200', '57600', '38400', '19200', '9600', '4800',

Page 266

setxpcenv14-94TcpIpGatewayValue is 'xxx.xxx.xxx.xxx'.In the xPC Target Explorer window TcpIp gateway address box, enter the IP address for y

Page 267

setxpcenv14-95TcpIpTargetISAMemPortValue is '0xnnnn'.If you are using an ISA bus Ethernet card, you must enter values for the properties Tcp

Page 268

2 Targets and Scopes in the MATLAB Interface2-16Note The difference between setting TriggerSample = (N + P - 1), where N and P are the parameters of

Page 269

setxpcenv14-96TargetScopeValues are 'Disabled' and 'Enabled'. From the xPC Target Explorer window Enable target scope list, select

Page 270

setxpcenv14-97The function setxpcenv works similarly to the set function of the MATLAB Handle Graphics® system. Call the function setxpcenv with an ev

Page 271

setxpcenv14-98 See Also The xPC Target functions getxpcenv, updatexpcenv, and xpcbootdisk. The procedures “Changing Environment Properties with xPC Ta

Page 272 - 14get (scope object)

start (scope object)14-9914start (scope object)Purpose Start execution of a scope on target PCSyntax MATLAB command linestart(scope_object_vector)scop

Page 273 - Number of samples, then

start (scope object)14-100somescopes = getscope(tg,[1,2]) or somescopes= tg.getscope([1,2])start(somescopes) or somescopes.startor typesc1 = getscope(

Page 274

start (target object)14-10114start (target object)Purpose Start execution of target application on target PCSyntax MATLAB command linestart(target_obj

Page 275

stop (scope object)14-10214stop (scope object)Purpose Stop execution of a scope on target PCSyntax MATLAB command linestop(scope_object_vector)scope_o

Page 276

stop (scope object)14-103See Also The xPC Target target object methods getscope, stop (target object), and start (target object). The scope object met

Page 277

stop (target object)14-10414stop (target object)Purpose Stop execution of target application on target PCSyntax MATLAB command linestop(target_object)

Page 278

targetping14-10514targetpingPurpose Test communication between a host and its target computersSyntax MATLAB command linetargetping(target_object)targe

Page 279

Working with Scope Objects2-17“Acquisition of Gap-Free Data” on page 2-17, illustrates how the scopes trigger one another.Acquisition of Gap-Free Data

Page 280

trigger14-10614triggerPurpose Software-trigger start of data acquisition for one or more scopesSyntax MATLAB command linetrigger(scope_object_vector)

Page 281 - 14get (target object)

unload14-10714unloadPurpose Remove current target application from target PCSyntax MATLAB command lineunload(target_object)target_object.unloadArgumen

Page 282

updatexpcenv14-10814updatexpcenvPurpose Change current environment properties to new propertiesSyntax MATLAB Command LineupdatexpcenvDescription Funct

Page 283

xpc14-10914xpcPurpose Call target object constructor, xpctarget.xpcNote See “xpctarget.xpc” on page 14-116

Page 284

xpcbootdisk14-11014xpcbootdiskPurpose Create xPC Target boot disk and confirm the current environment propertiesSyntax MATLAB Command LinexpcbootdiskD

Page 285

xpcexplr14-11114xpcexplrPurpose Open xPC Target Explorer windowSyntax MATLAB Command LinexpcexplrDescription This graphical user interface (GUI) allow

Page 286

xpctarget.fs14-11214xpctarget.fsPurpose Create xPC Target file system objectSyntax MATLAB command linefilesys_object = xpctarget.fs('mode',

Page 287

xpctarget.fs14-113If you have multiple target PCs in your system, or if you want to identify a target PC with the file system object, use the followin

Page 288

xpctarget.ftp14-11414xpctarget.ftpPurpose Create xPC Target FTP objectSyntax MATLAB command linefile_object = xpctarget.fs('mode', 'arg

Page 289

xpctarget.ftp14-115If you have multiple target PCs in your system, or if you want to identify a target PC with the file object, use the following synt

Page 290

2 Targets and Scopes in the MATLAB Interface2-18sc(1).trigger; % Start things off by triggering scope 1data = zeros(0, 2);t = [];scNum = 1; % We wi

Page 291

xpctarget.xpc14-11614xpctarget.xpcPurpose Create a target object representing target applicationSyntax MATLAB command linetarget_object = xpctarget.xp

Page 292

xpctarget.xpc14-117If you have multiple target PCs in your system, use the following syntax to create the additional target objects.target_object=xpct

Page 293

xpctargetping14-11814xpctargetpingPurpose Test communication between host and target computersSyntax MATLAB Command LinexpctargetpingExamples Check fo

Page 294

xpctargetspy14-11914xpctargetspyPurpose Open Real-Time xPC Target Spy window on host PCSyntax MATLAB Command Linexpctargetspy(target_object)Arguments

Page 295

xpctest14-12014xpctestPurpose Test the xPC Target installationSyntax MATLAB Command Linexpctestxpctest('noreboot')Arguments Description xpc

Page 296

xpcwwwenable14-12114xpcwwwenablePurpose Disconnect target PC from current client applicationSyntax MATLAB Command LinexpcwwwenableDescription Use this

Page 298 - RAM size

Index-1IndexAapplicationswith DOSLoader mode 4-16with StandAlone mode 4-21Bblock parametersparameter tuning with external mode 3-50Cchanging environme

Page 299

IndexIndex-2FreeDOScopying kernel 4-14copying kernel/application 4-22FTP objectsxpctarget.ftp introduction 7-4functionschanging parameters 3-47signal

Page 300

IndexIndex-3Rreadxpcfile 7-12Sscope objectscommand-line interface 1-3commands 1-3list of properties with files 3-30list of properties with targets 3-2

Page 301

3Signals and ParametersChanging parameters in your target application while it is running in real time, and checking the results by viewing signal da

Page 302

IndexIndex-4task execution time (TET)average 14-37definition 3-41in an example 3-42logging 14-41maximum 14-38minimum 14-38with the getlog function 14-

Page 303

IndexIndex-5xPC Target Exploreradding signals 3-16configuring the host scope viewer 3-23creating scopes 3-12monitoring signals 3-2stopping scopes 3-20

Page 305

3 Signals and Parameters3-2Monitoring SignalsSignal monitoring is the process for acquiring signal data during a real-time run without time informatio

Page 306

Monitoring Signals3-32 In the Solver pane, change the Stop time parameter to inf (infinity).3 To get the list of signals in the target application, ex

Page 308

3 Signals and Parameters3-4The Model Hierarchy node can have up to three types of nodes: subsystems ( ) (including their signals and parameters), para

Page 309

Monitoring Signals3-54 To get the value of a signal, select the signal in the Model Hierarchy node.The value of the signal is shown in the right pane.

Page 310

3 Signals and Parameters3-6Signal Monitoring with MATLABThis procedure uses the model xpc_osc3.mdl as an example, and assumes you created and download

Page 311

Monitoring Signals3-73 Click the Real-Time Workshop® node.The Real-Time Workshop pane opens.4 To build a basic target application, in the Target selec

Page 312 - Purpose Reboot target PC

3 Signals and Parameters3-88 In the chart, select Tools -> Explore.The Model Explorer is displayed.9 In the Model Explorer, expand sf_car.10 Expand

Page 313

Monitoring Signals3-93 Choose the state as you do a signal to monitor.Monitoring Stateflow States with MATLABThis topic assumes that you have already

Page 314

3 Signals and Parameters3-10For test pointed Stateflow states, the state appears in the BLOCK NAME column like any signal. For example, if you set a t

Page 315

Signal Tracing3-11Signal TracingSignal tracing is the process of acquiring and visualizing signals while running a target application. In its most bas

Page 316

3 Signals and Parameters3-12Creating Scopes1 In xPC Target Explorer, ensure that your xpcosc application is still running. 2 To get the list of signal

Page 317

Signal Tracing3-134 To create a scope to display on the target PC, right-click the Target Scopes node under the xPC Scopes node.A context menu appears

Page 318

iContents1Target and Scope ObjectsTarget Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2What Is a Target

Page 319

3 Signals and Parameters3-146 To create a scope to be displayed on the host PC, right-click the Host Scopes node under the xPC Scopes node.A context m

Page 320 - Description

Signal Tracing3-1510 To list the properties of the scope object Scope 2, select the xPC Target Explorer tab to return to that window, and left-click S

Page 321

3 Signals and Parameters3-1612 Right-click the File Scopes node under the xPC Scopes node.A scope node appears under File Scopes. In this example, the

Page 322

Signal Tracing3-173 Start the scope. For example, to start Scope 1, right-click it and select Start.The target screen plots the signals after collecti

Page 323

3 Signals and Parameters3-185 Expand the Scope 2 node.The Scope 2 signals are displayed.6 Start the scope. For example, to start the scope Scope 2, ri

Page 324

Signal Tracing3-197 Add signals to the scope of type file. For example, to add signals Integrator1 and Signal Generator, right-click each signal and s

Page 325

3 Signals and Parameters3-209 To specify a filename for the data file, select the scope of type file. In the right pane, enter a name in the Filename

Page 326

Signal Tracing3-21If you have scopes of type file, you can copy the file that contains the signal data from the target PC to the host PC. See “Copying

Page 327

3 Signals and Parameters3-223 Start the scope and target application.4 Right-click the scope to be triggered. For example, select Scope 1.5 Select Tri

Page 328

Signal Tracing3-23Configuring the Host Scope ViewerYou can customize your host scope viewer. This section assumes that you have added a host scope to

Page 329 - 14set (target object)

ii Contents3Signals and ParametersMonitoring Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2Signal Monitoring wi

Page 330

3 Signals and Parameters3-24Copying Files to the Host PCFrom xPC Target Explorer, you can download target PC files from the target PC to the host PC.

Page 331 - Simulation

Signal Tracing3-25A file Save As dialog is displayed.7 Choose the directory to contain the signal data file. If you want, you can also save the file u

Page 332

3 Signals and Parameters3-26Signal Tracing with MATLABCreating a scope object allows you to select and view signals using the scope methods. This sect

Page 333

Signal Tracing3-27ShowSignals = on Signals = INDEX VALUE BLOCK NAME0 0.000000 Integrator11 0.000000 Signal

Page 334 - 14setxpcenv

3 Signals and Parameters3-28 YLimit = Auto Grid = OnSignals = no Signals defined5 Add signals to the sc

Page 335

Signal Tracing3-29Signal Tracing with MATLAB and Scopes of Type FileThis procedure uses the Simulink model xpcosc.mdl as an example, and assumes you h

Page 336

3 Signals and Parameters3-303 Start running your target application. Type+tg or tg.start or start(tg)The target PC displays the following message:Syst

Page 337

Signal Tracing3-31 Mode = Lazy WriteSize = 512 AutoRestart = offNote that there is no name initially assigne

Page 338

3 Signals and Parameters3-32 TriggerScope = 2 TriggerSample = 0 TriggerSignal = 0 TriggerLevel = 0.000000 Trig

Page 339

Signal Tracing3-33Signal Tracing with xPC Target Scope BlocksUse scopes of type host to log signal data triggered by an event while your target applic

Page 340

iiiEmbedded Option Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9Updating the xPC Target Environment . . . . . . . . . . .

Page 341

3 Signals and Parameters3-34Scope of Type FileFor a scope of type file, the scope acquires data and writes it to the file named in the FileName parame

Page 342 - Interface” on page 5-6

Signal Tracing3-353 Click the Edit button.The scope editing pane opens. From this pane, you can edit the properties of any scope, and control the scop

Page 343

3 Signals and Parameters3-36Signal LoggingSignal logging is the process for acquiring signal data during a real-time run, stopping the target applicat

Page 344

Signal Logging3-371 In xPC Target Explorer, select the downloaded target application node. For example, xpc_osc4.The right pane displays the target ap

Page 345 - Target PC command line

3 Signals and Parameters3-385 Send the selected logged data to the MATLAB workspace. In the target application properties dialog for xpc_osc4, go to t

Page 346

Signal Logging3-39All scopes copy the last N samples from the log buffer to the target object logs (tg.TimeLog, tg.OutputLog, tg.StateLog, and tg.TETL

Page 347

3 Signals and Parameters3-40

Page 348

Signal Logging3-413 In the MATLAB window, typeplot(tg.TimeLog,tg.TETLog)Values for the task execution time (TET) log are uploaded to the host PC from

Page 349

3 Signals and Parameters3-424 In the MATLAB window, type eithertg.AvgTET or get(tg,'AvgTET')MATLAB displays the following information about

Page 350

Parameter Tuning and Inlining Parameters3-43Parameter Tuning and Inlining ParametersBy default, xPC Target lets you change parameters in your target a

Page 351

iv Contents6Using the Target PC Command-Line InterfaceTarget PC Command-Line Interface . . . . . . . . . . . . . . . . . . . . 6-2Using Target Appl

Page 352 - 14updatexpcenv

3 Signals and Parameters3-44Parameter Tuning with xPC Target ExplorerxPC Target lets you change parameters in your target application while it is runn

Page 353

Parameter Tuning and Inlining Parameters3-45The model hierarchy only shows blocks that have tunable parameters.4 Select the parameter of the signal yo

Page 354

3 Signals and Parameters3-46If there is a scope, the plot frame then updates the signals after running the simulation with the new parameter value.8 S

Page 355 - 14xpcexplr

Parameter Tuning and Inlining Parameters3-47Parameter Tuning with MATLABYou use the MATLAB functions to change block parameters. With these functions

Page 356 - 14xpctarget.fs

3 Signals and Parameters3-48Parameters = 3 Change the gain. For example, to change the Gain1 block, type eithertg.setparam(5,800) or setparam(tg,5,800

Page 357

Parameter Tuning and Inlining Parameters3-494 Stop the target application. In the MATLAB window, type-tg or tg.stop or stop(tg)The target application

Page 358 - 14xpctarget.ftp

3 Signals and Parameters3-502 To reset to the previous values, typesetparam(tg,pt.parIndexVec,pt.OldValues)ans = parIndexVec: 5OldValues: 800NewValues

Page 359

Parameter Tuning and Inlining Parameters3-512 In the Simulink block window, and from the Simulation menu, click Connect to target. All of the current

Page 360 - 14xpctarget.xpc

3 Signals and Parameters3-525 In the Gain text box, enter 800 and click OK.As soon as you change a model parameter and click OK, or you click the Appl

Page 361

Parameter Tuning and Inlining Parameters3-53Parameter Tuning with a Web BrowserThe Parameters pane displays a list of all the tunable parameters in yo

Page 362

v8Graphical User InterfacesxPC Target Interface Blocks to Simulink Models . . . . . . . . . 8-2Simulink User Interface Model . . . . . . . . . . . .

Page 363

3 Signals and Parameters3-54• You have parameters you would like to save for reuse. See- “Parameter Tuning with MATLAB” on page 3-47- “Parameter Tunin

Page 364 - MATLAB Command Line

Parameter Tuning and Inlining Parameters3-552 In the MATLAB window, type eithertg.loadparamset('xpc_osc4_param1') or loadparamset(tg,'x

Page 365 - 14xpcwwwenable

3 Signals and Parameters3-56Inlined ParametersThis procedure describes how you can globally inline parameters for a model, then specify which of these

Page 366

Parameter Tuning and Inlining Parameters3-578 Click the Configure button.The Model Parameter Configuration dialog is displayed. Note that the MATLAB w

Page 367

3 Signals and Parameters3-5812 Build and download the model to your target PC.You can next use xPC Target Explorer or MATLAB to work with the tunable

Page 368

Parameter Tuning and Inlining Parameters3-595 Enter a new value for the parameter.6 Press the Enter key.The box is updated and the Update Parameter bu

Page 369

3 Signals and Parameters3-609 Stop the target application.Tuning Inlined Parameters with MATLABThis procedure describes how you can tune inlined param

Page 370

Parameter Tuning and Inlining Parameters3-611 Save the following code in an M-file. For example, change_inlineA,tg=xpc; %Create xPC Target objectpid=t

Page 371

3 Signals and Parameters3-62

Page 372

4Embedded OptionThe xPC Target Embedded Option allows you to boot the target PC from a device other than a 3.5 inch disk drive, such as a hard disk o

Comments to this Manuals

No comments