MATLAB XPC TARGET 4 - API GUIDE Uživatelská příručka

Procházejte online nebo si stáhněte Uživatelská příručka pro Vývojový software MATLAB XPC TARGET 4 - API GUIDE. MATLAB XPC TARGET 4 - API GUIDE User`s guide [en] Uživatelská příručka

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 372
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků

Shrnutí obsahu

Strany 1 - User’s Guide

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

Strany 2 - How to Contact The MathWorks:

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

Strany 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,

Strany 4

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

Strany 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

Strany 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

Strany 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

Strany 8

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

Strany 9

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

Strany 10 - Troubleshooting

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

Strany 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

Strany 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

Strany 13 - Target and Scope Objects

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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 23

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

Strany 24

viii Contents

Strany 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

Strany 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

Strany 27

4 Embedded Option4-24

Strany 28

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

Strany 29

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

Strany 30

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

Strany 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

Strany 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

Strany 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

Strany 34

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

Strany 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.

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 44

6 Using the Target PC Command-Line Interface6-8

Strany 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

Strany 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

Strany 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

Strany 48

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

Strany 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)

Strany 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

Strany 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

Strany 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

Strany 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.

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 63

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

Strany 64

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

Strany 65

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

Strany 66

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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 73

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

Strany 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

Strany 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

Strany 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

Strany 77

8 Graphical User Interfaces8-14

Strany 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

Strany 79

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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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:

Strany 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

Strany 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

Strany 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

Strany 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

Strany 90

1 Target and Scope Objects1-6

Strany 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

Strany 92

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

Strany 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

Strany 94

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

Strany 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

Strany 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.

Strany 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

Strany 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

Strany 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

Strany 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

Strany 101

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

Strany 102

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

Strany 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 (

Strany 104

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

Strany 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

Strany 106

10 Interrupts Versus Polling10-14

Strany 107 - Embedded Option Setup

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

Strany 108

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

Strany 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

Strany 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

Strany 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

Strany 112

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

Strany 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

Strany 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-

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 122

11 xPC Target and Fortran11-14

Strany 123 - Software Environment

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

Strany 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

Strany 125 - Explorer

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

Strany 126

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

Strany 127

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

Strany 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

Strany 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

Strany 130

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

Strany 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

Strany 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

Strany 133 - Target PC

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

Strany 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

Strany 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

Strany 136

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

Strany 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

Strany 138

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

Strany 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

Strany 140 - Introduction

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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 145

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

Strany 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

Strany 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

Strany 148

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

Strany 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

Strany 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

Strany 151

12 Troubleshooting12-26

Strany 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

Strany 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

Strany 154

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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 160

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

Strany 161 - Block Parameters

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

Strany 162

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

Strany 163

14Function Reference

Strany 164

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

Strany 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

Strany 166

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

Strany 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

Strany 168

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

Strany 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

Strany 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,

Strany 171

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

Strany 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

Strany 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

Strany 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

Strany 175 - Main pane

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

Strany 176

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

Strany 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

Strany 178 - -1 or Inf

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

Strany 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)

Strany 180 - 1, enter

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

Strany 181 - Interrupts Versus Polling

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

Strany 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

Strany 183 - Polling Mode

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

Strany 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

Strany 185

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

Strany 186

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

Strany 187

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

Strany 188

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

Strany 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

Strany 190

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

Strany 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)

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 199

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

Strany 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

Strany 201 - Compiling Fortran Files

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

Strany 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

Strany 203

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

Strany 204

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

Strany 205 - Parameters

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

Strany 206

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

Strany 207

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

Strany 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

Strany 209

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

Strany 210 - 12 Troubleshooting

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

Strany 211 - Is the Target PC Halted?

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

Strany 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

Strany 213

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

Strany 214

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

Strany 215

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

Strany 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

Strany 217

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

Strany 218

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

Strany 219 - Create Bootdisk

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

Strany 220

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

Strany 221

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

Strany 222

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

Strany 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

Strany 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

Strany 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

Strany 226

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

Strany 227

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

Strany 228

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

Strany 229

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

Strany 230

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

Strany 231

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

Strany 232

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

Strany 233

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

Strany 234

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

Strany 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

Strany 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

Strany 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

Strany 238

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

Strany 239 - Scope Object Methods

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

Strany 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

Strany 241

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

Strany 242

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

Strany 243 - or move mouse

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

Strany 244

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

Strany 245

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

Strany 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(

Strany 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

Strany 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

Strany 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

Strany 250

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

Strany 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

Strany 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

Strany 253 - Arguments

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

Strany 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

Strany 255

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

Strany 256

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

Strany 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

Strany 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

Strany 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(

Strany 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

Strany 261

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

Strany 262 - function

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

Strany 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

Strany 264

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

Strany 265 - 14fc422mexcalcbits

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

Strany 266

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

Strany 267

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

Strany 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

Strany 269

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

Strany 270

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

Strany 271

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

Strany 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

Strany 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(

Strany 274

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

Strany 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

Strany 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

Strany 277

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

Strany 278

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

Strany 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

Strany 280

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

Strany 281 - 14get (target object)

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

Strany 282

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

Strany 283

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

Strany 284

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

Strany 285

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

Strany 286

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

Strany 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

Strany 288

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

Strany 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

Strany 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

Strany 291

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

Strany 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

Strany 293

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

Strany 294

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

Strany 295

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

Strany 296

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

Strany 298 - RAM size

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

Strany 299

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

Strany 300

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

Strany 301

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

Strany 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-

Strany 303

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

Strany 305

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

Strany 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

Strany 308

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

Strany 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.

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 315

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

Strany 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

Strany 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

Strany 318

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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 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

Strany 329 - 14set (target object)

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

Strany 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.

Strany 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

Strany 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

Strany 333

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

Strany 334 - 14setxpcenv

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

Strany 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

Strany 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

Strany 337

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

Strany 338

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

Strany 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

Strany 340

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

Strany 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

Strany 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

Strany 343

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

Strany 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

Strany 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

Strany 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

Strany 347

3 Signals and Parameters3-40

Strany 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

Strany 349

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

Strany 350

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

Strany 351

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

Strany 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

Strany 353

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

Strany 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

Strany 355 - 14xpcexplr

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

Strany 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

Strany 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

Strany 358 - 14xpctarget.ftp

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

Strany 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

Strany 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

Strany 361

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

Strany 362

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

Strany 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

Strany 364 - MATLAB Command Line

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

Strany 365 - 14xpcwwwenable

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

Strany 366

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

Strany 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

Strany 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

Strany 369

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

Strany 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

Strany 371

3 Signals and Parameters3-62

Strany 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

Komentáře k této Příručce

Žádné komentáře