xPC Target™ 4 User’s Guide
How to Contact MathWorks Web Newsgroup www.mathworks.com/contact_TS.html Technical Support www.mathworks.com comp.soft-sys.matlab suggest@mathworks.com bugs@mathworks.com doc@mathworks.com service@mathworks.com info@mathworks.com Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information 508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc.
Revision History September 1999 November 2000 June 2001 September 2001 July 2002 June 2004 August 2004 October 2004 November 2004 March 2005 September 2005 March 2006 May 2006 September 2006 March 2007 September 2007 March 2008 October 2008 March 2009 September 2009 March 2010 September 2010 First printing Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online only Online onl
Contents Target and Scope Objects 1 Target Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What Is a Target Object? . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 1-2 Scope Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What Is a Scope Object? . . . . . . . . . . . . . . . . . . . . . . . . . . . . Scope Object Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signals and Parameters 3 Monitoring Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Signal Monitoring with xPC Target Explorer . . . . . . . . . . . Signal Monitoring with the MATLAB Interface . . . . . . . . . Monitoring Stateflow States . . . . . . . . . . . . . . . . . . . . . . . . . Animating Stateflow Charts . . . . . . . . . . . . . . . . . . . . . . . . .
Booting from a DOS Device 4 DOSLoader Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DOSLoader Mode Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating a Target Application for DOSLoader Mode . . . . . Creating DOSLoader Files with a Command-Line Interface . . . . . . . . . . . . . . . .
Software Environment and Demos 6 Using Environment Properties and Functions . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Getting a List of Environment Properties for Default Target PCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing Environment Properties with xPC Target Explorer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using Target Application Methods on the Target PC . . . . . Manipulating Target Object Properties from the Target PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Manipulating Scope Objects from the Target PC . . . . . . . . Manipulating Scope Object Properties from the Target PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Graphical User Interfaces 10 xPC Target Interface Blocks to Simulink Models . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulink User Interface Model . . . . . . . . . . . . . . . . . . . . . . Creating a Custom Graphical Interface . . . . . . . . . . . . . . . . To xPC Target Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . From xPC Target Block . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Polling Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introducing Polling Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting the Polling Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . Restrictions Introduced by Polling Mode . . . . . . . . . . . . . . . Controlling the Target Application . . . . . . . . . . . . . . . . . . . Polling Mode Performance . . . . . . . . . . . . . . . . . . . . . . . . . . Polling Mode and Multicore Processors . . . .
Configuring the xPC Target and Vector CANape Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4 Setting Up and Building the Model . . . . . . . . . . . . . . . . . . . 14-4 Creating a New Vector CANape Project to Associate with a Particular Target Application . . . . . . . . . . . . . . . . . . . . . 14-6 Configuring the Vector CANape Device . . . . . . . . . . . . . . . . 14-7 Providing A2L (ASAP2) Files for the Vector CANape Database . . . . . . . . . . . . . . .
General I/O Troubleshooting Guidelines . . . . . . . . . . . . . . . Can I View the Contents of the Target PC Display on the Host PC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Why Do Attempts to Run My Model Cause CPU Overload Messages on the Target PC? . . . . . . . . . . . . . . . . . . . . . . How Can I Reduce the TET in My Application? . . . . . . . . . How Can I Obtain PCI Board Information for My xPC Target System? . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scope Object Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Scope Object Property Commands . . . . . . . . . . . . . . . . . . . . Aliasing with Variable Commands . . . . . . . . . . . . . . . . . . . 16-4 16-6 16-7 Function Reference 17 Software Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2 .............................................. 17-3 Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions 18 Configuration Parameters 19 xPC Target options Pane . . . . . . . . . . . . . . . . . . . . . . . . . . . xPC Target options Overview . . . . . . . . . . . . . . . . . . . . . . . . Automatically download application after building . . . . . . Download to default target PC . . . . . . . . . . . . . . . . . . . . . . . Specify target PC name . . . . . . . . . . . . . . . . . . . . . . . . . . . . Name of xPC Target object created by build process . . . . . Use default communication timeout . .
xvi Contents
1 Target and Scope Objects Before you can work with xPC Target™ target and scope objects, you should understand the concept of target and scope objects.
1 Target and Scope Objects Target Objects What Is a Target Object? The xPC Target software uses a target object (of class xpctarget.xpc) to represent the target kernel and your target application. Use target object functions to run and control real-time applications on the target PC with scope objects to collect signal data. See “Function Reference” and “Functions” for a reference of the target functions.
Scope Objects Scope Objects In this section... “What Is a Scope Object?” on page 1-3 “Scope Object Types” on page 1-4 What Is a Scope Object? The xPC Target software uses scope objects to represent scopes on the target PC. Use scope object functions to view and collect signal data. See “Function Reference” and “Functions” for a reference of the scope functions. The xPC Target software uses scopes and scope objects as an alternative to using Simulink® scopes and external mode.
1 Target and Scope Objects sample time is 0.005, the scope will acquire five identical samples for this signal, and then the next five identical samples, and so on. Understanding the structure of scope objects will help you to use the MATLAB command-line interface to view and collect signal data. Refer to Chapter 1, “Target and Scope Objects” for a description of how to use these objects, properties, and methods. A scope object on the host PC represents a scope on the target PC.
Scope Objects Each scope object type has a group of object properties particular to that object type.
1 Target and Scope Objects The xpcsctg scope object of type target has the following object properties: • Grid • Mode • YLimit The xpcschost scope object of type host has the following object properties: • Data • Time The xpcfs scope object of type file has the following object properties: • AutoRestart • Filename • Mode • WriteSize The xpcsc scope object has the following object properties.
Scope Objects • TriggerSlope • Type See the scope object function get (scope object) for a description of these object properties.
1 1-8 Target and Scope Objects
2 Targets and Scopes in the MATLAB Interface You can work with xPC Target target and scope objects through the MATLAB interface (MATLAB Command Window), the target PC command line, a Web browser, or an xPC Target API. This chapter describes how to use the MATLAB interface to work with the target and scope objects in the following sections. See Chapter 8, “Using the Target PC Command-Line Interface” for a description of the target PC command-line interface.
2 Targets and Scopes in the MATLAB® Interface Working with Target Objects In this section...
Working with Target Objects to the host through an RS-232 connection. In the MATLAB Command Window, type tg = xpctarget.xpc('rs232', 'COM1', '115200') The resulting target object is tg. 3 To check a connection between a host and a target, use the target function targetping. For example, tg.targetping Note To ensure that you always know which target PC is associated with your target object, you should always use this method to create target objects.
2 Targets and Scopes in the MATLAB® Interface Displaying Target Object Properties You might want to list the target object properties to monitor a target application. The properties include the execution time and the average task execution time. After you build a target application and target object from a Simulink model, you can list the target object properties. This procedure uses the default target object name tg as an example.
Working with Target Objects target_object.property_name = new_property_value For example, to change the stop time mode for the target object tg, • In the MATLAB window, type tg.stoptime = 1000 • Alternatively, you can type set(tg, 'stoptime', 1000) When you change a target object property, the new property value is downloaded to the target PC. The xPC Target kernel then receives the information and changes the behavior of the target application.
2 Targets and Scopes in the MATLAB® Interface Signals are not target object properties. To get the value of the Integrator1 signal from the model xpcosc, • In the MATLAB window, type outputvalue = getsignal (tg,0) where 0 is the signal index. • Alternatively, you can type tg.getsignal(0) Note Method names are case sensitive. You must type the entire name. Property names are not case sensitive. You do not need to type the entire name as long as the characters you do type are unique for the property.
Working with Scope Objects Working with Scope Objects In this section...
2 Targets and Scopes in the MATLAB® Interface sc1 The current scope properties are uploaded to the host PC, and then MATLAB displays a list of the scope object properties with the updated values. Because sc1 is a vector with a single element, you could also type sc1(1) or sc1([1]). Note Only scopes with type host store data in the properties scope_object.Time and scope_object.Data. For a list of target object properties with a description, see the target function get (target application object).
Working with Scope Objects Setting the Value of a Scope Property With the xPC Target software you can use either a function syntax or an object property syntax. The syntax set(scope_object, property_name, new_property_value) can be replaced by scope_object(index_vector).property_name = new_property_value For example, to change the trigger mode for the scope object sc1, • In the MATLAB window, type sc1.triggermode = 'signal' • Alternatively, you can type set(sc1,'triggermode', 'signal') or sc1.
2 Targets and Scopes in the MATLAB® Interface Getting the Value of a Scope Property You can list a property value in the MATLAB window or assign that value to a MATLAB variable. With the xPC Target software you can use either a function syntax or an object property syntax. The syntax get(scope_object_vector, property_name) can be replaced by scope_object_vector(index_vector).
Working with Scope Objects Note Method names are case sensitive. You must type the entire name. Property names are not case sensitive. You do not need to type the entire name as long as the characters you do type are unique for the property. Using the Method Syntax with Scope Objects Use the method syntax to run a scope object method. The syntax method_name(scope_object_vector, argument_list) can be replaced with either • scope_object.method_name(argument_list) • scope_object_vector(index_vector).
2 Targets and Scopes in the MATLAB® Interface 1 In the MATLAB window, type sc=tg.addscope('file') The xPC Target software creates a scope of type file for the application. 2 Type sc.addsignal(4) 3 To start the scope, type +sc 4 To start the target application, type +tg The xPC Target software adds signal 4 to the scope of type file. When you start the scope and application, the scope saves the signal data for signal 4 to a file, by default named C:\data.dat.
Working with Scope Objects Note Remember to start your scope to acquire signal data. For example, configure a scope of type file named sc to the application with the following characteristics: • Logs signal data into up to nine files whose sizes do not exceed 4096 bytes. • Creates files whose names contain the string file_.dat. • Contains signal 4. 1 In the MATLAB window, type tg.StopTime=-1; This parameter directs the target application to run indefinitely. 2 To add a scope of type file, type sc=tg.
2 Targets and Scopes in the MATLAB® Interface 6 To enable the file scope to create multiple log files with the same name pattern, type sc.Filename='file_<%>.dat'; This sequence directs the software to create up to nine log files, file_1.dat to file_9.dat on the target PC file system. 7 To add signal 4 to the file scope, type sc.addsignal(4); 8 To start the scope, type +sc 9 To start the target application, type +tg The software creates a log file named file_1.dat and writes data to that file.
Working with Scope Objects • Freerun — Starts to acquire data as soon as the scope is started (default) • Software — Starts to acquire data in response to a user request. You generate a user request when you call the scope method trigger or the scope function xPCScSoftwareTrigger.
2 Targets and Scopes in the MATLAB® Interface • If NumPrePostSamples is a positive number, the scope is in a posttriggering mode, where it starts collecting samples after the trigger event.
Working with Scope Objects - sc(2).TriggerSample = range 0 to (N + P - 1) In the figures below, TP is the trigger point or sample where a trigger event occurs. Scope 1 begins acquiring data as described. In the simplest case, where P = 0, Scope 1 acquires data right away. Pretriggering (P<0) on page 2-17 illustrates the behavior if P, the value of NumPrePostSamples, is negative. In this case, Scope 1 starts acquiring data |P| samples before TP. Scope 2 begins to acquire data only after TP occurs.
2 Targets and Scopes in the MATLAB® Interface Posttriggering (P>0) Scope 1 triggers Scope 2 after the trigger event occurs. The following describes some of the ways you can trigger Scope 2: • sc(2).TriggerSample = 0 — Causes Scope 2 to be triggered when Scope 1 is triggered. TP for both scopes as at the same sample. • sc(2).TriggerSample = n > 0 — Causes TP for Scope 2 to be n samples after TP for Scope 1. Note that setting sc(2).
Working with Scope Objects Note The difference between setting TriggerSample = (N + P - 1), where N and P are the parameters of the triggering scope (Scope 1) and TriggerSample = -1 is that in the former case, the first sample of Scope 2 will be at the same time as the last sample of Scope 1, whereas in the latter, the first sample of Scope 2 will be one sample after the last sample of Scope 1.
2 Targets and Scopes in the MATLAB® Interface Acquisition of Gap-Free Data The following procedure describes how you can programmatically acquire gap-free data with two scopes. 1 Ensure that you have already built and downloaded the Simulink model xpcosc.mdl to the target PC. 2 In the MATLAB Command Window, assign tg to the target PC and set the StopTime property to 1. For example, tg=xpctarget.xpc tg.StopTime = 1; 3 Add two scopes of type host to the target application.
Working with Scope Objects 5 Set the NumSamples property for both scopes to 500 and the TriggerSample property for both scopes to -1. With this property setting, each scope triggers the next scope at the end of its 500 sample acquisition. set(sc, 'NumSamples', 500, 'TriggerSample', -1) 6 Set the TriggerMode property for both scopes to 'Scope'. Set the TriggerScope property such that each scope is triggered by the other. set(sc, 'TriggerMode', 'Scope'); sc(1).TriggerScope = 2; sc(2).
2 Targets and Scopes in the MATLAB® Interface % Save the data. t( end + 1 : end + 500) = sc(scNum).Time; data(end + 1 : end + 500, :) = sc(scNum).Data; % Restart this scope. start(sc(scNum)); % Switch to the next scope. %Shortcut for if(scNum==1) scNum=2;else scNum=1,end scNum = 3 - scNum; end 11 When done, remove the scopes. % Remove the scopes we added. remscope(tg,[1 2]); The following is a complete code listing for the preceding double-buffering data acquisition procedure.
Working with Scope Objects start(tg); % Start things off by triggering scope 1. scNum = 1; sc(scNum).trigger; % Use the two scopes as a double buffer to log the data. while (1) % Wait until this scope has finished acquiring 500 samples % or the model stops (scope is interrupted). while ~(strcmp(sc(scNum).Status, 'Finished') || ... strcmp(sc(scNum).Status, 'Interrupted')), end % Stop buffering data when the model stops. if strcmp(tg.Status, 'stopped') break end % Save the data.
2 2-24 Targets and Scopes in the MATLAB® Interface
3 Signals and Parameters Changing parameters in your target application while it is running in real time, and checking the results by viewing signal data, are two important prototyping tasks. The xPC Target software includes command-line and graphical user interfaces to complete these tasks.
3 Signals and Parameters Monitoring Signals In this section... “Introduction” on page 3-2 “Signal Monitoring with xPC Target Explorer” on page 3-2 “Signal Monitoring with the MATLAB Interface” on page 3-9 “Monitoring Stateflow States” on page 3-10 “Animating Stateflow Charts” on page 3-14 Introduction Signal monitoring is the process for acquiring signal data during a real-time run without time information. The advantage with signal monitoring is that there is no additional load on the real-time tasks.
Monitoring Signals 1 If xPC Target Explorer is not started, start it now. In xPC Target Explorer, select the node of the running target application in which you are interested, for example, xpcosc. The target PC Target Application Properties pane appears. 2 In the Solver pane, change the Stop time parameter to inf (infinity). Click Apply. 3 To get the list of signals in the target application, expand the target application node, then expand the Model Hierarchy node under the target application node.
3 Signals and Parameters The model hierarchy expands to show the Simulink objects (signals and parameters) in the Simulink model.
Monitoring Signals The Model Hierarchy node can have the following types of nodes: Icons Nodes Subsystems, including their signals and parameter Referenced models, including their signals set as test points Parameters Signals Stateflow states set as test points Only xPC Target tunable parameters and signals of the application, as represented in the Simulink model, appear in the Model Hierarchy node. Note This example currently has only parameters and signals.
3 Signals and Parameters e Re-expand the Model Hierarchy node to see the labeled signals. To view the block path for a labeled signal, hover over the labeled signal. For example, To display all the model signals again, right-click the Model Hierarchy node and select View All Signals. You can still view the signal label by hovering over the labeled signal.
Monitoring Signals Note When working with signal labels: • Signal labels must be unique. • xPC Target software ignores signal labels in referenced models. f Return to the model, remove the signal name you added, and rebuild and download the target application. The remaining examples in this section assume that you do not have any labelled signals in your model. 5 To go to the corresponding Simulink model subsystem, right-click the application node and select Go to Simulink subsystem or block.
3 Signals and Parameters The value of the signal is shown in the right pane. 7 Right-click the target application and select Start. The application starts running. 8 To change the numeric format display of the signal, right-click the Model Hierarchy node and select Edit Signals Format String. The Display Format String dialog box is displayed.
Monitoring Signals 9 Enter the signal format. Use one of the following. By default, the format is %0.25g.
3 Signals and Parameters The latter command causes the MATLAB window to display a list of the target object properties for the available signals. For example, the signals for the model xpc_osc3.mdl are shown below. Note that the Label column is empty because there are no labelled signals in the model. If your signal has a unique label, its label is displayed in this column. If the label is not unique, the command returns an error. If the signal label is in a referenced model, the software ignores it.
Monitoring Signals The Configuration Parameters dialog box is displayed for the model. 3 Click the Real-Time Workshop node. The Real-Time Workshop pane opens. 4 To build a basic target application, in the Target selection section, click the Browse button at the System target file list. Click xpctarget.tlc, then click OK. 5 As necessary, you can click the xPC Target options node and continue to make changes. 6 When you are done, click OK.
3 Signals and Parameters 7 In the old_sf_car model, double-click the shift_logic chart. The shift_logic chart is displayed. 8 In the chart, click Tools > Explore. The Model Explorer is displayed. 9 In the Model Explorer, expand old_sf_car. 10 Expand shift_logic. 11 Expand gear_state, then select first. 12 In the rightmost pane, State first, select the Test point check box. This creates a test point for the first state.
Monitoring Signals 13 Click Apply. 14 Build and download the old_sf_car target application to the target PC. You can now view the states with xPC Target Explorer or the MATLAB interface. Monitoring Stateflow States with xPC Target Explorer This topic assumes that you have already set Stateflow states as test points (see “Monitoring Stateflow States” on page 3-10 if you have not).
3 Signals and Parameters Monitoring Stateflow States with the MATLAB Interface This topic assumes that you have already set Stateflow states as test points (see “Monitoring Stateflow States” on page 3-10 if you have not). 1 To get a list of signals in the MATLAB Command Window, type tg=xpc 2 To display the signals in the target application, type either set(tg, 'ShowSignals', 'On'); tg or tg.
Monitoring Signals 1 Ensure that the model is in Simulink external mode. 2 In the Simulink window, from the Simulation menu, click Configuration Parameters. 3 Navigate to the xPC Target options node. 4 Select the Enable Stateflow animation check box. 5 Build and download the model to the target PC. 6 In the Simulink window, from the Simulation menu, click Connect to Target. 7 In the Simulink window, from the Simulation menu, click Start Real-Time Code.
3 Signals and Parameters Signal Tracing In this section... “Introduction” on page 3-16 “Signal Tracing with xPC Target Explorer” on page 3-16 “Signal Tracing with the MATLAB Interface” on page 3-40 “Signal Tracing with xPC Target Scope Blocks” on page 3-49 “Signal Tracing with Simulink External Mode” on page 3-51 “Signal Tracing with a Web Browser” on page 3-55 Introduction Signal tracing is the process of acquiring and visualizing signals while running a target application.
Signal Tracing • “Software Triggering Scopes” on page 3-29 • “Configuring the Host Scope Viewer” on page 3-31 • “Acquiring Signal Data into Multiple, Dynamically Named Files on the Target PC” on page 3-31 • “Copying Files to the Host PC” on page 3-35 • “Exporting Data from File Scopes to MATLAB Workspace” on page 3-36 • “Saving and Reloading xPC Target Application Sessions” on page 3-38 • “Deleting Files from the Target PC” on page 3-40 You can add or remove signals from target or host scopes while the sco
3 Signals and Parameters The model hierarchy expands to show the elements in the Simulink model. 3 To get the list of scope types you can have in the target application, expand the xPC Scopes node below the application node. The xPC Scopes node expands to show the possible scope types a target application can have.
Signal Tracing 4 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. This lists the actions you can perform on target PC scopes. For example, within the current context, you can create a target PC scope. 5 Select Add Target Scope. A scope node appears under Target Scopes. In this example, the new scope is labeled Scope 1.
3 Signals and Parameters You can add other scopes, including those of type host and file. Note, you can add as many file and host scopes as you want. as long as your target PC resources can support them. 6 To create a scope to be displayed on the host PC, right-click the Host Scopes node under the xPC Scopes node. A context menu appears. This lists the actions you can perform on host PC scopes. For example, within the current context, you can create a host PC scope. 7 Select Add Host Scope.
Signal Tracing 9 Select View Scopes. The xPC Target Host Scope Viewer window appears. Note that the signals you add to the scope will appear at the top right of the viewer. 10 To list the properties of the scope object Scope 2, click the xPC Target Explorer tab to return to that window, and left-click Scope 2. (Note that you can configure the docking view using the MATLAB docking feature.) The scope properties are shown in the rightmost pane.
3 Signals and Parameters 11 To create a scope to acquire signal data into a file on the target PC file system, right-click the File Scopes node under the xPC Scopes node. Select Add File Scope. A scope node appears under File Scopes. In this example, the new scope is labeled Scope 3. By default, the software creates a file in the target PC C:\ folder. The name of the file typically consists of the scope object name, ScopeId, and the beginning letters of the first signal added to the scope.
Signal Tracing 12 If you want to specify a different folder or filename, select the scope. The scope property pane is displayed. In the File name field, enter the full pathname for the file. Note that the current folder for the target PC appears at the top of the pane.
3 Signals and Parameters Your next task is to add signals to the scopes. The following procedure assumes that you have added scopes to the target PC and host PC. Adding Signals to Scopes This topic describes how to add signals using the xPC Target Explorer Add to Scopes command. If a scope does not exist, you can drag a signal to a Host Scope, Target Scope, or File Scope icon to create a scope of that type in xPC Target Explorer.
Signal Tracing 3 Start the scope. For example, to start Scope 1, right-click it and select Start.
3 Signals and Parameters The target screen plots the signals after collecting each data package. During this time, you can observe the behavior of the signals while the scope is running. 4 Add signals to the host PC scope. For example, to add signals Integrator1 and Signal Generator, right-click each signal and select Add to Scopes. From the Add to Scopes list, select Scope 2. (Note that you can also drag a signal from one scope to another to add that signal to another scope.
Signal Tracing 6 Start the scope. For example, to start the scope Scope 2, right-click Scope 2 in the Host Scopes node of the xPC Target Explorer and select Start. The xPC Target Host Scope Viewer window plots the signals after collecting each data package. During this time, you can observe the behavior of the signals while the scope is running.
3 Signals and Parameters 7 Add signals to the scope of type file. For example, to add signals Integrator1 and Signal Generator, right-click each signal and select Add to Scopes. From the Add to Scopes list, select Scope 3. (Note that you can also drag a signal from one scope to another to add that signal to another scope.) The Scope 3 node is shown with a plus sign. 8 Expand the Scope 3 node. The Scope 3 signals are displayed. 9 To specify a filename for the data file, select the scope of type file.
Signal Tracing The signals shown on the target PC stop updating while the target application continues running, and the target PC displays the following message: Scope: 1, set to state 'interrupted' 2 Stop the target application. For example, to stop the target application xpcosc, right-click xpcosc and select Stop. The target application on the target PC stops running, and the target PC displays the following messages: minimal TET: 0.0000006 at time 0.001250 maximal TET: 0.0000013 at time 75.
3 Signals and Parameters 2 From the Trigger mode list, select Software. Click Apply. 3 Start the scope and target application. 4 Observe that the scope has no plotted data. 5 Right-click the scope to be triggered. For example, select Scope 1. 6 Select Trigger. 7 Observe that the scope now has plotted data.
Signal Tracing Configuring the Host Scope Viewer You can customize your host scope viewer. This section assumes that you have added a host scope to your target application, started the host scope viewer, and added signals Integrator1 and Signal Generator (see “Creating Scopes” on page 3-17 and “Adding Signals to Scopes” on page 3-24). These viewer settings are per scope. In the xPC Target Host Scope Viewer, right-click anywhere in the axis area of the viewer. A context menu is displayed.
3 Signals and Parameters of type file to that application. You can then configure that scope to log signal data to multiple files. This section assumes that you have added a scope to your target application (see “Creating Scopes” on page 3-17). It also assumes that you have added signals to that scope (see “Adding Signals to Scopes” on page 3-24). 1 In xPC Target Explorer, expand the target PC node associated with the target PC file system you want to access. For example, expand TargetPC1.
Signal Tracing 6 To enable the file scope to create multiple log files with the same name pattern, in the File name box, enter a name like file_<%>.dat. This sequence directs the software to create up to nine log files, file_1.dat to file_9.dat, on the target PC file system.
3 Signals and Parameters 7 Select the Enable auto restart check box. The Enable file auto increment check box is enabled. 8 Select the Enable file auto increment check box. 9 In the Max file size box, enter a value to limit the size of the signal log files. For example, to limit each log file size to 4096 bytes, enter 4096. This value must be a multiple of the Write size value. 10 Click Apply. The saved values appear as follows: 11 Right-click the new file scope and select Start.
Signal Tracing You can enable the creation of up to 99999999 files (<%%%%%%%%>.dat). The length of a file name, including the specifier, cannot exceed eight characters. See the Filename description in the get (target application object) for a details about this specifier. Copying Files to the Host PC From xPC Target Explorer, you can download target PC files from the target PC to the host PC. 1 In xPC Target Explorer, expand the target PC node associated with the target PC file system you want to access.
3 Signals and Parameters 6 Select Save to Host PC. A browser dialog box is displayed. 7 Choose the folder to contain the signal data file. If you want, you can also save the file under a different name or create a new folder for the file. xPC Target Explorer copies the contents of the selected file, SC1INTEG.DAT for example, to the selected folder. You can examine the contents of the signal data file.
Signal Tracing created a scope of type file that contains signal data (see “Adding Signals to Scopes” on page 3-24). 1 In xPC Target Explorer, expand the target PC node associated with the target PC file system you want to access. For example, expand TargetPC1. 2 Under TargetPC1, find the target application and ensure that it is not running. 3 Under TargetPC1, expand the xPC Scopes node. All the scopes you have added are displayed.
3 Signals and Parameters You can examine and otherwise manipulate the data. You can also plot the data with plot(sig_integ.data). This is an alternate method to “Retrieving the Contents of a File from the Target PC to the Host PC” on page 9-11 in Chapter 9, “Working with Target PC Files and File Systems”.
Signal Tracing A Save Target Session as dialog box is displayed. 4 As necessary, browse to the desired folder and enter a unique name. For example, xpcsession1.mat. To restore a session, 1 Ensure that xPC Target Explorer is connected to a target PC. 2 In xPC Target Explorer, load a target application on the target PC. This target application must be the same target application for which the session was saved.
3 Signals and Parameters A Load Target Session as dialog box is displayed. 4 As necessary, browse to the desired folder and select the session you are interested in. For example, xpcsession1.mat. A dialog box is displayed asking you to confirm that you want to load a new session. 5 Click Yes. xPC Target Explorer loads the saved settings. Deleting Files from the Target PC From xPC Target Explorer on the host PC, you can delete the scope data file on the target PC file system.
Signal Tracing functions instead of using the xPC Target graphical user interface. This procedure assumes that you have assigned tg to the appropriate target PC. After you create and download the target application, you can view output signals.
3 Signals and Parameters tg.ShowSignals='on' The MATLAB window displays a list of the target object properties for the available signals. For example, the signals for the model xpcosc.mdl are as follows: ShowSignals = on Signals = INDEX 0 1 2 3 4 5 6 VALUE 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 BLOCK NAME Integrator1 Signal Generator Gain Integrator Gain1 Gain2 Sum LABEL For more information, see “Signal Monitoring with the MATLAB Interface” on page 3-9.
Signal Tracing NumSamples NumPrePostSamples Decimation TriggerMode TriggerSignal TriggerLevel TriggerSlope TriggerScope TriggerSample Mode YLimit Grid Signals = = = = = = = = = = = = = 250 0 1 FreeRun -1 0.000000 Either 1 -1 Redraw (Graphical) Auto On no Signals defined 5 Add signals to the scope object. For example, to add Integrator1 and Signal Generator, type sc1.addsignal ([0,1]) or addsignal(sc1,[0,1]) The target PC displays the following messages.
3 Signals and Parameters The target screen plots the signals after collecting each data package. During this time, you can observe the behavior of the signals while the scope is running. 7 Stop the scope. Type either -sc1 or sc1.stop or stop(sc1) The signals shown on the target PC stop updating while the target application continues running, and the target PC displays the following message. Scope: 1, set to state 'interrupted' 8 Stop the target application.
Signal Tracing Signal Tracing with the MATLAB Interface and File Scopes This procedure uses the Simulink model xpcosc.mdl as an example, and assumes you have built the target application for this model. It also assumes that you have a serial communication connection. This topic describes how to trace signals with file scopes . Note The signal data file can quickly increase in size. You should examine the file size between runs to gauge the growth rate of the file.
3 Signals and Parameters 3 Start running your target application. Type +tg or tg.start or start(tg) The target PC displays the following message: System: execution started (sample time: 0.0000250) 4 Create a scope to be displayed on the target PC. For example, to create a scope with an identifier of 2 and a scope object name of sc2, type sc2=tg.addscope('file', 2) or sc2=addscope(tg, 'file', 2) 5 List the properties of the scope object.
Signal Tracing TriggerScope TriggerSample TriggerSignal TriggerLevel TriggerSlope ShowSignals FileName Mode WriteSize AutoRestart DynamicFileName MaxWriteFileSize = = = = = = = = = = = = 2 0 -1 0.000000 Either off unset Lazy 512 off off 536870912 Note that there is no name initially assigned to FileName. After you start the scope, xPC Target assigns a name for the file to acquire the signal data.
3 Signals and Parameters or start(sc2) The MATLAB window displays a list of the scope object properties. Notice that FileName is assigned a default filename to contain the signal data for the scope of type file. This name typically consists of the scope object name, ScopeId, and the beginning letters of the first signal added to the scope.
Signal Tracing stop(sc2) 9 Stop the target application. In the MATLAB window, type -tg or tg.stop or stop(tg) The target application on the target PC stops running, and the target PC displays messages similar to the following. minimal TET: 0.00006 at time 0.004250 maximal TET: 0.000037 at time 14.255250 To access the contents of the signal data file that the xPC Target scope of type file creates, use the xPC Target file system object (xpctarget.fs) from the host PC MATLAB window.
3 Signals and Parameters Note If your model has the output of a Mux block connected to the input of an xPC Target Scope block, the signal might not be observable. To ensure that you can observe the signal, add a unity gain block (a Gain block with a gain of 1) between the Mux block and the xPC Target Scope block. Using xPC Target Scope Blocks from Referenced Models You cannot add any type of xPC Target scope to a referenced model. Doing so causes an error.
Signal Tracing If you want the same data for the same signals on the host PC while the data is displayed on the target PC, you need to define a second scope object with type host. Then you need to synchronize the acquisitions of the two scope objects by setting TriggerMode for the second scope to 'Scope'. Scope of Type File For a scope of type file, the scope acquires data and writes it to the file named in the FileName parameter in blocks of size WriteSize.
3 Signals and Parameters Limitations The following are limitations of uploading xPC Target signals to Simulink external mode: • When setting up signal triggering (Source set to signal), you must explicitly specify the element number of the signal in the Trigger signal:Element field. If the signal is a scalar, enter a value of 1. If the signal is a wide signal, enter a value from 1 to 10. Do not enter Last or Any in this field when uploading xPC Target signals to Simulink scopes.
Signal Tracing 4 Ensure that the Source parameter is set to manual. 5 Set the Mode parameter to normal. This ensures that the scope acquires data continuously. 6 Select the Arm when connecting to target check box. 7 In the Duration box, enter the number of samples for which external mode is to log data. The External Signal & Triggering dialog box should look similar to the figure shown. 8 Click Apply, then Close. 9 In the Simulink window, increase the simulation stop time.
3 Signals and Parameters 10 From the File menu, select Save As and enter a filename. For example, enter my_xpc_osc6.mdl and then click OK. 11 Build and download the target application. In the Simulink window and from the Tools menu, select Real-Time Workshop. From the Real-Time Workshop submenu, select Build Model. The xPC Target software downloads the target application to the default target PC. 12 In the Simulink window, and from the Simulation menu, select External.
Signal Tracing Signal Tracing with a Web Browser The Web browser interface allows you to visualize data using a graphical user interface. After you connect a Web browser to the target PC, you can use the scopes page to add, remove, and control scopes on the target PC: 1 In the left frame, click the Scopes button. The browser loads the Scopes List pane into the right frame. 2 Click the Add Scope button. A scope of type target is created and displayed on the target PC.
3 Signals and Parameters scope, remove existing scopes, and control all aspects of a scope from this page. To create a scope of type host, use the drop-down list next to the Add Scope button to select Host. This item is set to Target by default. 3 Click the Edit button. The scope editing pane opens. From this pane, you can edit the properties of any scope, and control the scope. 4 Click the Add Signals button. The browser displays an Add New Signals list.
Signal Logging Signal Logging In this section... “Introduction” on page 3-57 “Signal Logging with xPC Target Explorer” on page 3-57 “Signal Logging in the MATLAB Interface” on page 3-60 “Signal Logging with a Web Browser” on page 3-64 Introduction Signal logging is the process for acquiring signal data during a real-time run, stopping the target application, and then transferring the data to the host PC for analysis. This is also known as real-time data streaming to the target PC.
3 Signals and Parameters To create xpc_osc4: 1 In the MATLAB window, type xpc_osc3 The xpc_osc3 model opens. 2 In the Simulink window, select and delete the xPC Target Scope block and its connecting line. 3 From the File menu, click Save as. Enter xpc_osc4 and then click Save. You can now build and download the model (see “Building and Downloading the Target Application” in the xPC Target Getting Started Guide).
Signal Logging 3 Start the target application. For example, in the xPC Target Hierarchy pane, right-click the xpc_osc4 target application, then select Start. 4 Stop the target application. For example, in the Target Hierarchy pane, right-click the xpc_osc4 target application, then select Stop. 5 Send the selected logged data to the MATLAB workspace. In the target application properties dialog box for xpc_osc4, go to the Logging pane and click the Send to MATLAB Workspace button.
3 Signals and Parameters You can examine and otherwise manipulate the data. Signal Logging in the MATLAB Interface You plot the outputs and states of your target application to observe the behavior of your model, or to determine the behavior when you vary the input signals and model parameters.
Signal Logging assumes you have created and downloaded the target application for that model. It also assumes that you have assigned tg to the appropriate target PC. 1 In the MATLAB window, type tg=xpc 2 Type +tg or tg.start or start(tg) The target application starts and runs until it reaches the final time set in the target object property tg.StopTime. The outputs are the signals connected to Simulink Outport blocks. The model xpcosc.
3 Signals and Parameters The plot shown below is the result of a real-time execution. To compare this plot with a plot for a non-real-time simulation, see “Simulating the Model from MATLAB” of the xPC Target Getting Started Guide. 4 In the MATLAB window, type plot(tg.TimeLog,tg.TETLog) Values for the task execution time (TET) log are uploaded to the host PC from the target PC. If you want to upload part of the logs, see the target object method getlog.
Signal Logging The plot shown below is the result of a real-time run. The TET is the time to calculate the signal values for the model during each sample interval. If you have subsystems that run only under certain circumstances, plotting the TET would show when subsystems were executed and the additional CPU time required for those executions. 5 In the MATLAB window, type either tg.
3 Signals and Parameters The MATLAB interface displays the following information about the average task execution time. ans = 5.7528e-006 The percentage of CPU performance is the average TET divided by the sample time. Note that each outport has an associated column vector in tg.OutputLog. You can access the data that corresponds to a particular outport by specifying the column vector for that outport. For example, to access the data that corresponds to Outport 2, use tg.outputlog(:,2).
Signal Logging Task execution time — Logging the task execution time is possible only if you select the Log Task Execution Time check box in the Configuration Parameters xPC Target options node. This check box is selected by default. See “Entering Parameters for an xPC Target Scope Block” in xPC Target Getting Started Guide.
3 Signals and Parameters Parameter Tuning and Inlining Parameters In this section...
Parameter Tuning and Inlining Parameters Note Opening a dialog box for a source block causes Simulink to pause. While Simulink is paused, you can edit the parameter values. You must close the dialog box to have the changes take effect and allow Simulink to continue. Parameter Tuning with xPC Target Explorer The xPC Target software lets you change parameters in your target application while it is running in real time.
3 Signals and Parameters The Model Hierarchy expands to show the elements in the Simulink model. The model hierarchy shows only those blocks that have tunable parameters. 4 Select the parameter of the signal you want to edit. For example, select Gain. The right pane displays the block parameters dialog box for Gain. There is one parameter, Gain, for this block. The current value of the Gain parameter is displayed. 5 Double-click the box that contains the gain value. The box becomes editable.
Parameter Tuning and Inlining Parameters 7 Press the Enter key. The box is updated and the Update Parameter button becomes active. If there is a scope, the plot frame then updates the signals after running the simulation with the new parameter value. 8 Stop the target application. For example, to stop the target application xpcosc, right-click it and select Stop. The target application on the target PC stops running.
3 Signals and Parameters Parameter Tuning with the MATLAB Interface You use the MATLAB functions to change block parameters. With these functions, you do not need to set the Simulink interface to external mode, and you do not need to connect the Simulink interface with the target application. You can download parameters to the target application while it is running or between runs. This feature lets you change parameters in your target application without rebuilding the Simulink model.
Parameter Tuning and Inlining Parameters Parameters = INDEX VALUE TYPE SIZE PARAMETER NAME BLOCK NAME 0 1000000 DOUBLE Scalar Gain Gain 1 400 DOUBLE Scalar Gain Gain1 2 1000000 DOUBLE Scalar Gain Gain2 3 0 DOUBLE Scalar Initial Condition Integrator 4 0 DOUBLE Scalar Initial Condition Integrator1 5 4 DOUBLE Scalar Amplitude Signal Generator 6 20 DOUBLE Scalar Frequency Signal Generator 3 Change the gain.
3 Signals and Parameters -tg or tg.stop or stop(tg) The target application on the target PC stops running, and the target PC displays messages like the following: minimal TET: 0.000023 at time 1313.789000 maximal TET: 0.000034 at time 407.956000 Note Method names are case sensitive and need to be complete, but property names are not case sensitive and need not be complete as long as they are unique.
Parameter Tuning and Inlining Parameters 2 To reset to the previous values, type setparam(tg,pt.parIndexVec,pt.OldValues) ans = parIndexVec: 5 OldValues: 800 NewValues: 100 Parameter Tuning with Simulink External Mode You use Simulink external mode to connect your Simulink block diagram to your target application. The block diagram becomes a graphical user interface to your target application.
3 Signals and Parameters All of the current Simulink model parameters are downloaded to your target application. This downloading guarantees the consistency of the parameters between the host model and the target application. 3 From the Simulation menu, click Start Real-Time Code, or, in the MATLAB window, type +tg or tg.start or start(tg) The target application begins running on the target PC, and the target PC displays the following message: System: execution started (sample time: 0.
Parameter Tuning and Inlining Parameters 5 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 Apply button on the Block Parameters: Gain1 dialog box, all the changed parameters in the model are downloaded to the target application. 6 From the Simulation menu, click Disconnect from Target. The Simulink model is disconnected from the target application.
3 Signals and Parameters The target application on the target PC stops running, and the target PC displays the following messages: minimal TET: 0.000023 at time 1313.789000 maximal TET: 0.000034 at time 407.956000 Parameter Tuning with a Web Browser The Parameters pane displays a list of all the tunable parameters in your model. Row and column indices for vector/matrix parameters are also shown.
Parameter Tuning and Inlining Parameters The procedures assume that • You have a target application object named tg. • You have assigned tg to the appropriate target PC. • You have a target application downloaded on the target PC. • You have parameters you would like to save for reuse.
3 Signals and Parameters Loading Saved Parameters to a Target Application To load a set of saved parameters to a target application, use the loadparamset method. You must load parameters to the same model from which you save the parameter file. If you load a parameter file to a different model, the behavior is undefined. This section assumes that you have a parameters file saved from an earlier run of saveparamset (see “Saving the Current Set of Target Application Parameters” on page 3-77).
Parameter Tuning and Inlining Parameters 2 Load the parameter file. For example, type tg.loadparamset('xpc_osc4_param1'); 3 Display a list of parameters. For example, type tg.ShowParameters='on'; and then type tg The MATLAB window displays a list of parameters and their values for the target object. Inlined Parameters This procedure describes how you can globally inline parameters for a model, then specify which of these parameters you still want to be tunable.
3 Signals and Parameters 3 Double-click the Signal Generator block and enter A for the Amplitude parameter. Click OK. 4 In the MATLAB Command Window, assign a constant to that variable. For example, type A = 4 The value is displayed in the MATLAB workspace. 5 In the Simulink window, from the Simulation menu, click Configuration Parameters. The Configuration Parameters dialog box for the model is displayed. 6 Click the Optimization node. 7 In the rightmost pane, select the Inline parameters check box.
Parameter Tuning and Inlining Parameters The Model Parameter Configuration dialog box appears as follows. If you have more global parameters you want to be able to tune, add them also. 10 Click Apply, then click OK. 11 In the Configuration Parameters dialog, click Apply, then OK. 12 If you want, increase the model stop time, or set it to inf. 13 When you are finished, click Apply, then OK, and save the model. For example, save it as xpc_osc5.mdl. 14 Build and download the model to your target PC.
3 Signals and Parameters You next can use xPC Target Explorer or the MATLAB interface to work with the tunable parameters. Tuning Inlined Parameters with xPC Target Explorer This procedure describes how you can tune inlined parameters through the xPC Target Explorer. It assumes that you have built and downloaded the model from the topic “Inlined Parameters” on page 3-79 to the target PC. It also assumes that the model is running. 1 If you have not yet started xPC Target Explorer, do so now.
Parameter Tuning and Inlining Parameters 5 Enter a new value for the parameter and press Enter. The box is updated and the Update Parameter button becomes active. 6 To apply the new value, click the Update Parameter button. 7 To verify the updated value, select the signal object associated with A. For example, select Signal Generator.
3 Signals and Parameters The value of Signal Generator is shown in the right pane. 8 Stop the target application. Tuning Inlined Parameters with the MATLAB Interface This procedure describes how you can tune inlined parameters through the MATLAB interface. It assumes that you have built and downloaded the model from the topic “Inlined Parameters” on page 3-79 to the target PC. It also assumes that the model is running.
Parameter Tuning and Inlining Parameters 1 Save the following code in a MATLAB file. For example, change_inlineA. tg=xpc; %Create xPC Target object pid=tg.getparamid('','A'); %Get parameter ID of A if isempty(pid) %Check value of pid. error('Could not find A'); end tg.setparam(pid,100); %If pid is valid, set parameter value. 2 Execute that MATLAB file. For example, type change_inlineA 3 To see the new parameter value, type tg.
3 Signals and Parameters Nonobservable Signals and Parameters Observable signals are those that you can monitor, trace, and log. Nonobservable signals are those that exist in the target application, but which are not observable from the host PC. You cannot observe the following types of signals: • Virtual or bus signals (including all signals from bus and virtual blocks). You can access these signals from nonvirtual source blocks. • Signals that you have optimized with block reduction optimization.
4 Booting from a DOS Device • “DOSLoader Mode” on page 4-2 • “Creating a DOS System Disk” on page 4-6
4 Booting from a DOS Device DOSLoader Mode In this section... “Introduction” on page 4-2 “DOSLoader Mode Setup” on page 4-2 “Restrictions” on page 4-3 “Creating a Target Application for DOSLoader Mode” on page 4-4 “Creating DOSLoader Files with a Command-Line Interface” on page 4-4 Introduction DOSLoader mode allows you to boot the xPC Target kernel on a target PC from a fixed or removable device with DOS boot capability, such as a hard disk or flash memory.
DOSLoader Mode 4 In the Configuration pane, select the DOSLoader tab. 5 In the Location field, enter or browse to the directory where you want to create the DOSLoader boot files and click OK. This location can be a local directory on the host PC or a removable storage device that you will use to boot the target PC. By default, the directory is the current working directory. 6 Click Apply. 7 Click Create DOS Loader. This operation creates the following boot files in the specified location: autoexec.
4 Booting from a DOS Device • While loaded in memory, the DOS partition must not overlap the address range of a target application. To satisfy these restrictions: - Do not use additional memory managers like emm386 or qemm. Avoid any utilities that attempt to load in high memory (for example, himem.sys). If the target PC DOS environment does not use a config.sys file or memory manager entries in the autoexec.bat file, there should typically be no problems when starting the xPC Target software.
DOSLoader Mode getxpcenv 2 Ensure that the following xPC Target properties are set as indicated: • TargetBoot — DOSLoader • DOSLoaderLocation — Your host PC DOSLoader files location 3 If these properties are not set with the correct values, use the setxpcenv function to set them.
4 Booting from a DOS Device Creating a DOS System Disk To use the DOSLoader mode, you need a minimal DOS system on the target PC boot device. MathWorks has tested the xPC Target product with FreeDOS Beta 8 (“Nikita”) distribution, MS-DOS (6.0 or higher), PC DOS, and Caldera OpenDOS. You can use a copy of any of these DOS systems to boot the target PC. Note xPC Target software does not include a DOS license. You must obtain a valid DOS license for your target PC.
5 Embedded Option The xPC Target Embedded Option™ product allows you to boot the target PC from a device other than a 3.5-inch disk or CD drive or network boot image, such as a hard disk or flash memory. It also allows you to deploy stand-alone applications on the target PC independent of the host PC.
5 Embedded Option Introduction The xPC Target Embedded Option software allows you to boot the xPC Target kernel from a 3.5-inch disk drive and other devices, including a flash disk or a hard disk drive. By using the xPC Target Embedded Option software, you can configure a target PC to automatically start execution of your embedded application for continuous operation each time the system is booted. You can use this capability to deploy your own real-time applications on target PC hardware.
xPC Target Embedded Option™ Modes xPC Target Embedded Option Modes In this section... “Introduction” on page 5-3 “Standalone Mode Overview” on page 5-4 “Restrictions” on page 5-5 Introduction The xPC Target Embedded Option software extends the xPC Target base product with the Standalone mode Use this mode to load the target PC with both the xPC Target kernel and a target application. This mode of operation can start the kernel on the target PC from a flash disk or hard disk.
5 Embedded Option The following are some instances where you might want to use the xPC Target Embedded Option product. You might have one of these situations if you deploy the target PC in a small or rugged environment. • Target PC does not have a 3.5-inch disk or CD drive. • The Target PC 3.5-inch or CD disk drive must be removed after setting up the target system. • You do not have a dedicated network to boot the target PC from the host PC.
xPC Target Embedded Option™ Modes 8 Copy the contents of model_name_emb to the target PC hard drive. The target PC hard drive should now contain the following files: • DOS files — Provide your own copy of DOS to boot the target PC (see step 1). • *.rtb — This file contains the xPC Target kernel. It also contains, as applicable, options such as serial or TCP/IP communications and the IP address of the target PC. • xpcboot.com — This file executes loads and executes the *.rtb file. • autoexec.
5 Embedded Option • While loaded in memory, the DOS partition must not overlap the address range of a target application. To satisfy these restrictions, • Do not use additional memory managers like emm386 or qemm. • Avoid any utilities that attempt to load in high memory (for example, himem.sys). If the target PC DOS environment does not use a config.sys file or memory manager entries in the autoexec.bat file, there should be no problems when running xpcboot.com.
Embedded Option Setup Embedded Option Setup Creating a DOS System Disk When using Standalone mode, you must first boot your target PC with DOS. You can use Standalone mode from a boot device such as flash disk or a hard disk drive. To boot DOS with a target boot disk, a minimal DOS system is required on the boot disk. With DOS, you can create a DOS boot disk using the command sys A: Note The xPC Target Embedded Option product does not include a DOS license.
5 Embedded Option Stand-Alone Target Setup In this section... “Before You Start” on page 5-8 “Updating Environment Properties” on page 5-9 “Creating a Kernel/Target Application” on page 5-9 “Copying the Kernel/Target Application to the Target PC Flash Disk” on page 5-10 Before You Start Standalone mode combines the target application with the kernel and boots them together on the target PC from the hard drive (or, alternatively, flash memory). The host PC does not need to be connected to the target PC.
Stand-Alone Target Setup Updating Environment Properties The xPC Target software uses the environment properties to determine what files to create for the various target boot modes. This procedure assumes you have serial or network communication working correctly between your host computer and a target PC. 1 On the host computer, start the MATLAB interface. 2 In the MATLAB window, type xpcexplr The xPC Target Explorer window opens.
5 Embedded Option A Simulink window opens with the model. 2 From the Tools menu, point to Real-Time Workshop, and then click Build Model. Real-Time Workshop and xPC Target software create a folder xpc_osc3_xpc_emb with the following files: • autoexec.bat — This file is automatically invoked by DOS. It then runs xpcboot.com and the *.rtb file. • xpc_osc3.rtb — This image contains the xPC Target kernel and your target application. • xpcboot.
Stand-Alone Target Setup 2 In the MATLAB Command Window, change folder on the host computer to the folder that contains the kernel/target application files. 3 Create the folder C:\xpcfiles and copy files to that folder. For example, type f=xpctarget.ftp f.mkdir('xpcfiles') f.cd('xpcfiles') f.put('autoexec.bat') f.put('xpcboot.com') f.put('xpc_osc3.rtb') 4 If you want your stand-alone application to run when you reboot your target PC, remove the 3.
5 Embedded Option Note Do not confuse C:\xpcfiles\autoexec.bat with C:\autoexec.bat. The file C:\xpcfiles\autoexec.bat includes the command xpcboot.com to start the xPC Target kernel and stand-alone application. The file C:\autoexec.bat includes the files you want the system to execute when the system starts up. 7 Reboot the target PC. 8 The sequence of calls during the boot process is a C:\autoexec.bat b C:\xpcfiles\autoexec.bat c C:\xpcfiles\xpcboot.com d C:\xpcfiles\.
6 Software Environment and Demos • “Using Environment Properties and Functions” on page 6-2 • “xPC Target Demos” on page 6-9
6 Software Environment and Demos Using Environment Properties and Functions In this section... “Introduction” on page 6-2 “Getting a List of Environment Properties for Default Target PCs” on page 6-2 “Changing Environment Properties with xPC Target Explorer” on page 6-3 “Changing Environment Properties with a Command-Line Interface for Default Target PCs” on page 6-7 Introduction The xPC Target environment defines the connections and communication between the host and target computers.
Using Environment Properties and Functions setxpcenv The MATLAB interface displays a list of xPC Target environment properties and the allowed values. For a list of the properties, see the function getxpcenv. 2 Type getxpcenv The MATLAB interface displays a list of xPC Target environment properties and the current values. Alternatively, you can use the xPC Target Explorer window to view and change environment properties.
6 Software Environment and Demos The MATLAB interface opens the xPC Target Explorer window. Note the contents of the left pane. This is the xPC Target Hierarchy pane. This pane contains all the objects in your xPC Target hierarchy. As you add objects to your system, xPC Target Explorer adds their corresponding nodes to the xPC Target Hierarchy pane. The most important node is the HostPC node. It represents the host PC. The most important node is the TargetPC node.
Using Environment Properties and Functions The Configuration node under the Target PC node has the target PC-specific configuration pane. If your license does not include the xPC Target Embedded Option product, you can choose Boot Floppy, CD Boot, DOS Loader, or Network Boot. With the xPC Target Embedded Option license, you have the additional choice of Standalone. 2 Change properties in the environment in the right pane by entering new property values in the text boxes or choosing items from the lists.
6 Software Environment and Demos • Auto — The target kernel automatically attempts to determine the amount of memory. • Manual — The amount of RAM, in MB, installed on the target PC. This field defines the total amount of installed RAM in the target PC. The RAM is used for the kernel, target application, data logging, and other functions that use the heap. 4 From the Maximum model size list, select either 1 MB, 4 MB, or 16 MB.
Using Environment Properties and Functions 9 From the Target scope list, select either Enabled or Disabled. The property Target scope is set by default to Enabled. If you set Target scope to Disabled, the target PC displays information as text. To use all the features of the target scope, you also need to install a keyboard on the target PC. 10 Set the Target scope property to Enabled.
6 Software Environment and Demos The environment properties you changed with the function setxpcenv become the current values.
xPC Target™ Demos xPC Target Demos In this section... “Introduction” on page 6-9 “To Locate or Edit a Demo Script” on page 6-11 Introduction The xPC Target demos are used to demonstrate the features of the xPC Target product. They are also scripts that you can view to understand how to write your own scripts for creating and testing target applications. There are two categories of xPC Target demos, general applications and drivers. The following lists the general application demos.
6 Software Environment and Demos Description Filename Logging signal data to a file on the target PC Data Logging With a File Scope Frame signal processing Frame Signal Processing Note This demo requires Signal Processing Blockset™ software.
xPC Target™ Demos You can access xPC Target general application and driver demos through the MATLAB Online Help. In this window, xPC Target > Demos to list the available demo categories. To Locate or Edit a Demo Script 1 In the MATLAB Command Window, type which scfreerundemo The MATLAB interface displays the location of the MATLAB file for the demo. C:\MATLAB\toolbox\rtw\targets\xpc\xpcdemos\scfreerundemo.
6 6-12 Software Environment and Demos
7 Working with Target PC Environments
7 Working with Target PC Environments Target Environment Command-Line Interface In this section...
Target Environment Command-Line Interface In the MATLAB window, type tgs.get CCompiler: CompilerPath: DefaultTarget: NumTargets: 'VisualC' 'c:\Microsoft Visual Studio' [1x1 xpctarget.env] 2 To display the value of particular target PC environment collection object property, use the syntax get(env_collection_object, property_name) or env_collection_object.property_name. In the MATLAB window, type tgs.
7 Working with Target PC Environments Adding Target PC Environment Collection Objects To add a target PC environment collection object, use the target PC environment collection object method add. In the MATLAB window, type tgs.Add Check that an additional target PC environment collection object has been added. Type tgs.get CCompiler: CompilerPath: DefaultTarget: NumTargets: 'VisualC' 'c:\Microsoft Visual Studio' [1x1 xpctarget.
Target Environment Command-Line Interface Changing Target PC Environment Object Defaults By default, the first target PC environment object is the default one. Functions such as getxpcenv and setxpcenv operate only on the default target PC environment object. To make another environment object be the default one, use the target PC environment collection object method makeDefault. Type tgs.
7 Working with Target PC Environments TcpIpTargetAddress: TcpIpTargetPort: TcpIpSubNetMask: TcpIpGateway: TcpIpTargetDriver: TcpIpTargetBusType: TcpIpTargetISAMemPort: TcpIpTargetISAIRQ: '222.222.222.222' '22222' '255.255.255.255' '255.255.255.255' 'I82559' 'PCI' '0x300' '5' Using the dot notation, change the properties as necessary. For example, to change the IP address of TargetPC2 to 192.168.0.10, the subnet mask to 255.255.255.0, type env2.TcpIpTargetAddress='192.168.0.10' env2.TcpIpSubNetMask='255.
Target Environment Command-Line Interface Alternatively, you can type env.TcpIpTargetPort ans = 22222 env2.TcpIpTargetAddress ans = 192.168.0.
7 7-8 Working with Target PC Environments
8 Using the Target PC Command-Line Interface You can interact with the xPC Target environment through the target PC command window. The xPC Target software provides a limited set of commands that you can use to work with the target application after it has been loaded to the target PC, and to interface with the scopes for that application.
8 Using the Target PC Command-Line Interface Target PC Command-Line Interface In this section...
Target PC Command-Line Interface 2 In the Cmd box, type a target PC command. For example, to start your target application, type start 3 To stop the application, type stop Once the command window is active, you do not have to reactivate it before typing the next command. Manipulating Target Object Properties from the Target PC The xPC Target software uses a target object to represent the target kernel and your target application.
8 Using the Target PC Command-Line Interface The command window displays a message to indicate that the new parameter has registered. System: p[1] is set to 30.00000 4 Check the value of signal 0. For example, type s0 The command window displays a message to indicate that the new parameter has registered. System: S0 has value 5.1851 5 Change the stop time.
Target PC Command-Line Interface The target PC activates the command window. 2 Type a scope command. For example, to add a target scope (scope 2) in the model xpcosc, type addscope 2 The xPC Target software adds another scope monitor to the target PC screen. The command window displays a message to indicate that the new scope has registered. Scope: 2, created, type is target S0 3 Type a scope command.
8 Using the Target PC Command-Line Interface These commands create a temporary difference between the behavior of the target application and the properties of the target object. The next time you access the target object, the properties are updated from the target PC. 1 On the target PC keyboard, press C. The target PC activates the command window. 2 Type a scope property command.
Target PC Command-Line Interface 2 Type the variable name to run that command sequence. For example, to turn the motor on, type on The parameter P7 is changed to 1, and the motor turns on.
8 8-8 Using the Target PC Command-Line Interface
9 Working with Target PC Files and File Systems • “Introduction” on page 9-2 • “FTP and File System Objects” on page 9-4 • “Using xpctarget.ftp Objects” on page 9-5 • “Using xpctarget.
9 Working with Target PC Files and File Systems Introduction xPC Target file scopes create files on the target PC. To work with these files from the host PC, you need to work with the xpctarget.ftp and xpctarget.fs objects. The xpctarget.ftp object allows you to perform basic file transfer operations on the target PC file system. The xpctarget.fs object allows you to perform file system-like operations on the target PC file system.
Introduction You can access signal data files, or any target PC system file, in one of the following ways: • If you are running the target PC as a stand-alone system, you can access that file by rebooting the target PC under an operating system such as DOS and accessing the file through the operating system utilities. • If you are running the target PC in conjunction with a host PC, you can access the target PC file from the host PC by representing that file as an xpctarget.ftp object.
9 Working with Target PC Files and File Systems FTP and File System Objects The xPC Target software uses two objects, xpctarget.ftp and xpctarget.fs (file system), to work with files on a target PC. You use the xpctarget.ftp object to perform file transfer operations between the host and target PC. You use the xpctarget.fs object to access the target PC file system. For example, you can use an xpctarget.fs object to open, read, and close a signal data file created by an xPC Target file scope.
Using xpctarget.ftp Objects Using xpctarget.ftp Objects In this section... “Overview” on page 9-5 “Accessing Files on a Specific Target PC” on page 9-6 “Listing the Contents of the Target PC Folder” on page 9-7 “Retrieving a File from the Target PC to the Host PC” on page 9-7 “Copying a File from the Host PC to the Target PC” on page 9-8 Overview The xpctarget.
9 Working with Target PC Files and File Systems Accessing Files on a Specific Target PC You can access specific target PC files from the host PC for the xpctarget.ftp object. Use the xpctarget.ftp creator function. If your system has multiple targets, you can access specific target PC files from the host PC for the xpctarget.ftp object.
Using xpctarget.ftp Objects Listing the Contents of the Target PC Folder You can list the contents of the target PC folder by using xPC Target methods on the host PC for the xpctarget.ftp object. Use the method syntax to run an xpctarget.ftp object method: method_name(ftp_object) Note You must use the dir(f) syntax to list the contents of the folder. To get the results in an M-by-1 structure, use a syntax like y=dir(f). See the dir method reference for further details.
9 Working with Target PC Files and File Systems For example, to retrieve a file named data.dat from the target PC C:\ drive (default), 1 If you have not already done so, in the MATLAB window, type the following to assign the xpctarget.ftp object to a variable. f=xpctarget.ftp; 2 Type f.get('data.dat'); This retrieves the file and saves that file to the variable data. This content is in the xPC Target file format.
Using xpctarget.fs Objects Using xpctarget.fs Objects In this section...
9 Working with Target PC Files and File Systems • removefile to remove a file from the target PC • rmdir to remove a folder Useful global utility: • readxpcfile, to interpret the raw data from the fread method The procedures in this section assume that the target PC has a signal data file created by an xPC Target file scope. This file has the pathname C:\data.dat.
Using xpctarget.fs Objects 1 In the MATLAB window, type a command like the following to assign the xpctarget.xpc object to a variable. tg1=xpctarget.xpc('TCPIP','192.168.0.10','22222'); 2 Type the following command to assign the xpctarget.fs object to the tg1 target object variable. fs=xpctarget.fs(tg1); Alternatively, if you want to work with the file system of the default target PC, you can use the xpctarget.fs constructor without arguments.
9 Working with Target PC Files and File Systems 1 If you have not already done so, in the MATLAB window, type the following to assign the xpctarget.fs object to a variable. fsys=xpctarget.fs; 2 Type h=fsys.fopen('data.dat'); or h=fopen(fsys,'data.dat'); This opens the file data.dat for reading and assigns the file identifier to h. 3 Type data2=fsys.fread(h); or data2=fread(fsys,h); This reads the file data.dat and stores the contents of the file to data2.
Using xpctarget.fs Objects in xPC Target format. The data must be a vector of bytes (uint8). To convert the data to uint8, use a command like the following: data2 = uint8(data2'); This section assumes that you have a variable, data2, that contains data in the xPC Target file format (see “Retrieving the Contents of a File from the Target PC to the Host PC” on page 9-11): 1 In the MATLAB window, change folder to the folder that contains the xPC Target format file.
9 Working with Target PC Files and File Systems x[0] y[0] z[0] t[0] x[1] y[1] z[1] t[1] x[2] y[2] z[2] t[2]... x[N] y[N] z[N] t[N] N is the number of samples acquired. The file saves x, y, z, and t as doubles at 8 bytes each. Removing a File from the Target PC You can remove a file from the target PC by using xPC Target methods on the host PC for the xpctarget.ftp object. If you have not already done so, close this file first with fclose. Use the method syntax to run an xpctarget.fs object method.
Using xpctarget.fs Objects fs_object.method_name(argument_list) For example, to get a list of open files for the file system object fsys, 1 If you have not already done so, in the MATLAB window, type the following to assign the xpctarget.fs object to a variable. fsys=xpctarget.fs; 2 Type fsys.filetable If the file system has open files, a list like the following is displayed: ans = Index Handle Flags FilePos Name -----------------------------------------0 00060000 R__ 8512 C:\DATA.
9 Working with Target PC Files and File Systems Use the method syntax to run an xpctarget.fs object method. The syntax method_name(fs_object, argument_list) can be replaced with fs_object.method_name(argument_list) For example, to display the information for the file identifier fid1, 1 If you have not already done so, in the MATLAB window, type the following to assign the xpctarget.fs object to a variable. fsys=xpctarget.fs; 2 Type fid1=fsys.fopen('data.dat'); This opens the file data.
Using xpctarget.fs Objects For example, to display the disk information for the C:\ drive, 1 If you have not already done so, in the MATLAB window, type the following to assign the xpctarget.fs object to a variable. fsys=xpctarget.fs; 2 Type fsys.diskinfo('C:\'); This returns disk information like the following for the C:\ drive file system.
9 9-18 Working with Target PC Files and File Systems
10 Graphical User Interfaces
10 Graphical User Interfaces xPC Target Interface Blocks to Simulink Models In this section...
xPC Target™ Interface Blocks to Simulink® Models Simulink 3D Animation — The Simulink 3D Animation product enables you to display a Simulink user interface model in 3-D. It provides Simulink blocks that communicate with xPC Target interface blocks. These blocks then communicate to a graphical interface. This graphical interface is a Virtual Reality Modeling Language (VRML) world displayed with a Web browser using a VRML plug-in.
10 Graphical User Interfaces 4 In the MATLAB interface, run the function xpcsliface('model_name') to create the user interface template model. This function generates a new Simulink model containing only the xPC Target interface blocks (To xPC Target and From xPC Target) defined by the tagged block parameters and block signals in the target application model. 5 To the user interface template model, add Simulink interface blocks from add-on products (Simulink 3D Animation, Altia Design).
xPC Target™ Interface Blocks to Simulink® Models Note The use of To xPC Target blocks requires a connection between the host and target PC. If there is no connection between the host and target PC, operations such as opening a model that contains these blocks or copying these blocks within or between models, will take significantly longer than normal. From xPC Target Block This block behaves like a source and its output is usually connected to the input of a display device.
10 Graphical User Interfaces Because only one numerical value per signal is uploaded during a time step, the number of samples of a scope object is set to 1. The block uses the capability of the xPC Target command-line interface and is implemented as a MATLAB S-function. This block is available from the xpclib/Misc sublibrary. See From xPC Target in the xPC Target I/O Reference for further configuration details. Note The use of From xPC Target blocks requires a connection between the host and target PC.
xPC Target™ Interface Blocks to Simulink® Models target application, and you use this model to select the parameters and signals you want to connect to a custom graphical interface. Creating a target application model is the first step you need to do before you can tag block parameters and block signals for creating a custom graphical interface. See “Marking Block Parameters” on page 10-7 and “Marking Block Signals” on page 10-9 for descriptions of how to mark block properties and block signals.
10 Graphical User Interfaces 4 In the Description box, delete the existing tag and enter a tag to the parameters for this block. For example, the SetPoint block is a constant with a single parameter that selects the level of water in the tank. Enter the tag shown below. The tag has the following format syntax xPCTag(1, . . . index_n)= label_1 . . . label_n; For single dimension ports, the following syntax is also valid: xPCTag=label; index_n -- Index of a block parameter.
xPC Target™ Interface Blocks to Simulink® Models 5 Repeat steps 1 through 3 for the remaining parameters you want to tag.
10 Graphical User Interfaces After you create a Simulink model, you can mark the block signals. This procedure uses the model xpctank1.mdl (or xpctank.mdl) as an example. See “Creating a Target Application Model” on page 10-6. Note that you cannot select signals on the output ports of any virtual blocks such as Subsystem and Mux blocks. Also, you cannot select signals on any function-call, triggered signal output ports. 1 Open a Simulink model.
xPC Target™ Interface Blocks to Simulink® Models For example, the block labeled TankLevel is an integrator with a single signal that indicates the level of water in the tank. Replace the existing tag with the tag shown below. The tag has the following format syntax: xPCTag(1, . . . index_n)=label_1 . . . label_n; For single dimension ports, the following syntax is also valid: XPCTag=label: • index_n — Index of a signal within a vector signal line. Begin numbering signals with an index of 1.
10 Graphical User Interfaces To create the From xPC blocks in an user interface model for a signal line with four signals (port dimension of 4), use the following syntax: xPCTag(1,2,3,4)=label_1 label_2 label_3 label_4; To create the From xPC blocks for the second and fourth signals in a signal line with at least four signals, use the following syntax: xPCTag(2,4)=label_1 label_2; Note Only tag signals from nonvirtual blocks. Virtual blocks are only graphical aids (see “Virtual Blocks”).
11 xPC Target Web Browser Interface
11 xPC Target™ Web Browser Interface Web Browser Interface In this section...
Web Browser Interface Before you connect your Web browser on the host PC, you must load a target application onto the target PC. The target application does not have to be running, but it must be loaded. Also, your browser must have JavaScript and StyleSheets turned on. Note Ensure that you close all other connections to the target PC. For example, if you are currently connected to the target PC through xPC Target Explorer, right-click on that target PC icon and select Disconnect.
11 xPC Target™ Web Browser Interface 1 In the MATLAB window, type xpcwwwenable or close(xpc) The MATLAB interface is disconnected from the target PC, leaving the target PC ready to connect to another client. The TCP/IP stack of the xPC Target kernel supports only one simultaneous connection. If you do not use this command, the TCP/IP to RS-232 gateway might not be able to connect to the target PC. 2 Open a DOS command window, and enter the command to start the TCP/IP to RS-232 gateway.
Web Browser Interface 5 In the DOS command window, press Ctrl+C. The TCP/IP to RS-232 Gateway stops running, and the DOS command window displays the message interrupt received, shutting down The gateway application has a handler that responds to Ctrl+C by disconnecting and shutting down cleanly. In this case, Ctrl+C is not used to abort the application. 6 In the MATLAB Command Window, type xpc The MATLAB interface reconnects to the target application and lists the properties of the target object.
11 xPC Target™ Web Browser Interface CommandLine Option Description -v Verbose mode. Produces a line of output every time a client connects or disconnects. -n Allows nonlocal connections. By default, only clients from the same computer that the gateway is running on are allowed to connect. This option allows anybody to connect to the gateway. If you do not use this option, only the host PC that is connected to the target PC with a serial cable can connect to the selected port.
Web Browser Interface Using the Main Pane The Main pane is divided into four parts, one below the other. The four parts are System Status, xPC Target Properties, Navigation, and WWW Properties.
11 xPC Target™ Web Browser Interface After you connect a Web browser to the target PC, you can use the Main pane to control the target application: 1 In the left frame, click the Refresh button. System status information in the top cell is uploaded from the target PC. If the right frame is either the Signals List pane or the Screen Shot pane, updating the left frame also updates the right frame. 2 Click the Start Execution button.
Web Browser Interface 4 Enter new values in the StopTime and SampleTime boxes, then click the Apply button. You can enter -1 or Inf in the StopTime box for an infinite stop time. The new property values are downloaded to the target application. Note that the SampleTime box is visible only when the target application is stopped. You cannot change the sample time while a target application is running. (See “User Interaction” in the xPC Target Getting Started Guide for limitations on changing sample times.
11 xPC Target™ Web Browser Interface Signals with a width greater than the value you enter are not displayed on the Signals pane. 2 In the Refresh Interval box, enter a value greater than 10. For example, enter 20. The signal pane updates automatically every 20 seconds. Entering -1 or Inf does not automatically refresh the pane. Sometimes, both the frames try to update simultaneously, or the auto refresh starts before the previous load has finished. This problem can happen with slow network connections.
Web Browser Interface The Screen Shot pane is loaded and a copy of the current target PC screen is displayed. The screen shot uses the portable network graphics (PNG) file format. Viewing Parameters with a Web Browser The Parameters pane displays a list of all the tunable parameters in your model. Row and column indices for vector/matrix parameters are also shown.
11 xPC Target™ Web Browser Interface 3 In the Target selection section, access levels are set in the System target file box. For example, to set the access level to 1, enter xpctarget.tlc -axpcWWWAccessLevel=1 The effect of not specifying -axpcWWWAccessLevel is that the highest access level (0) is set. 4 Click OK. The various fields disappear, depending on the access level. For example, if your access level does not allow you access to the parameters, you do not see the button for parameters.
12 Execution Modes • “Introducing Execution Modes” on page 12-2 • “Interrupt Mode” on page 12-3 • “Polling Mode” on page 12-5
12 Execution Modes Introducing Execution Modes Introduction Interrupt mode is the default real-time execution mode for the xPC Target kernel. In certain conditions, you might want to change the real-time execution mode to polling mode. A good understanding of interrupt and polling modes will help you to use them effectively, and to decide under which circumstances it makes sense for you to switch to the polling mode. A third execution mode, freerun, is also available.
Interrupt Mode Interrupt Mode Interrupt mode is the default real-time execution mode for the kernel. This mode provides the greatest flexibility and is the mode you should choose for any application that executes at the given base sample time without overloading the CPU. The scheduler ensures real-time single-tasking and multitasking execution of single-rate or multirate systems, including asynchronous events (interrupts).
12 Execution Modes • CPU hardware latency — Modern CPUs try to predict the next couple of instructions, including branches, by the use of instruction pipelines. If an interrupt occurs, the prediction fails and the pipeline has to be fully reloaded. This process introduces an additional latency. Additionally, because of interrupts, cache misses will occur.
Polling Mode Polling Mode Polling mode for the kernel is designed to execute target applications at sample times close to the limit of the hardware (CPU). Using polling mode with high-speed and low-latency I/O boards and drivers allows you to achieve smaller sample times for applications that you cannot achieve using the interrupt mode of the xPC Target software.
12 Execution Modes Even a highly clocked CPU is not likely to lead to an overflow of a 64 bit counter (2^64 * 1e-9 (1 GHz CPU) = 584 years). The Pentium counter comes with the following features: • Accurate measurements — Because the counter counts up with the CPU clock rate (~1 GHz nowadays), the accuracy of time measurements even in the microsecond range is very high, therefore leading to very small absolute real-time errors.
Polling Mode • Use the fastest available computer hardware — Ensure that the CPU with the highest clock rate available is used for a given PC form factor. For the desktop form factor, this would mean a clock rate above 3 GHz; for a mobile application, e.g., using the PC/104 form factor, this would mean a clock rate above 1 GHz. Executing xpcbench at the MATLAB prompt gives a relative measure of CPU performance when running typical target applications.
12 Execution Modes 3 In the TLC options edit field, specify the option -axpcCPUClockPoll=CPUClockRateMHz The assignment of the clock rate of the target PC’s CPU is necessary because the Pentium’s on-chip counter used for polling mode counts up with the CPU clock rate. If the clock rate is provided, the kernel can convert clock ticks to seconds and vice versa. If an incorrect clock rate is provided, the target application executes at an incorrect base sample time.
Polling Mode -axpcCPUClockPoll=1200 If you want to execute the target application in interrupt mode again, either remove the option or assign a CPU clock rate of 0 to the option: -axpcCPUClockPoll=0 If you make a change to the TLC options field, you need to rebuild the target application for the change to take effect. Building the target application, downloading it, and preparing it for a run then work exactly the same way as they did with default interrupt mode.
12 Execution Modes Restrictions Introduced by Polling Mode As explained above, polling mode executes the Simulink-based target application in real time exclusively. While the target application is executing in polling mode, all background tasks, including those for host-target communication, target screen updating, and UDP transfers, are inactive. This is because all interrupts of the target PC are fully disabled during the execution of the target application.
Polling Mode Nevertheless, there is a way to stop the execution interactively before reaching the target application stop time. See “Controlling the Target Application” on page 12-13. If the target application execution finally reaches the stop time and polling mode execution is stopped, host-target communication will begin functioning again. However, the host-target communication link might be in a bad state.
12 Execution Modes The Only Rapid-Prototyping Feature Available Is Data Logging Because host-target communication and target screen updating are disabled during the entire run, most of the common rapid-prototyping features of the xPC Target product are not available in polling mode.
Polling Mode rates, the CPU will most likely overload for the given base sample time. As an important consequence, polling mode is only a feasible alternative to interrupt mode if the model has a single rate or if it can be converted to a single-rate model. A single-rate model implies continuous states only, discrete states only, or mixed continuous and discrete states, if the continuous and discrete subsystems have the same rate.
12 Execution Modes execution of the target application, depending on the state of the digital input signal. You can either use a hardware switch connected to the board-specific input pin or you can generate the signal by other means. For example, you could use another digital I/O board in the host machine and connect the two boards (one in the host, the other in the target) over a couple of wires.
Polling Mode The minimum achievable base sample time for this model using an ode4 fixed-step integration algorithm is 11 µs with signal logging disabled and 12 µs with signal logging enabled. This equals a sample rate of almost 100 kHz. The achievable sample time for the same model in interrupt mode is ~28 µs or a sample rate of ~33 kHz. For this application, the overall performance increase using polling mode is almost a factor of 3.
12 12-16 Execution Modes
13 Incorporating Fortran Code into the xPC Target Environment • “Before You Start” on page 13-2 • “Step-by-Step Example of Fortran and xPC Target” on page 13-5
13 Incorporating Fortran Code into the xPC Target™ Environment Before You Start In this section... “Introduction” on page 13-2 “Simulink Demos Folder” on page 13-2 “Prerequisites” on page 13-3 “Steps to Incorporate Fortran in the Simulink Software for xPC Target” on page 13-3 Introduction The xPC Target product supports the incorporation of Fortran code into Simulink models. This chapter describes how to incorporate Fortran into a Simulink model for the xPC Target software.
Before You Start A list of Simulink examples appears. 3 Click Custom Code and Hand Coded Blocks using the S-function API. The associated Simulink demos page opens. 4 Click Open this model. S-function examples are displayed. 5 Double-click the Fortran S-functions block. Fortran S-functions and associated templates appear. Prerequisites You must have xPC Target Version 1.3 or later to use Fortran for xPC Target applications. The xPC Target product supports the Fortran compiler(s) listed here: http://www.
13 Incorporating Fortran Code into the xPC Target™ Environment 4 Run a simulation C-MEX file with the Simulink software to validate the compiled Fortran code and wrapper S-function. 5 Copy relevant Fortran run-time libraries to the application build folder for the xPC Target application build. 6 Define the Fortran libraries, and the Fortran object files from step 1, in the Real-Time Workshop dialog box of the Simulink model.
Step-by-Step Example of Fortran and xPC Target™ Step-by-Step Example of Fortran and xPC Target In this section...
13 Incorporating Fortran Code into the xPC Target™ Environment 2 Type sfcndemo_atmos The sfcndemo_atmos model is displayed. 3 Add an xPC Target Scope block of type Target. 4 Connect this Scope block to the Tamb, K signal. The model sfcndemo_atmos.mdl should look like the figure shown. 5 Double-click the target Scope block. 6 From the Scope mode parameter, choose Graphical rolling. 7 For the Number of samples parameter, enter 240.
Step-by-Step Example of Fortran and xPC Target™ 8 Click Apply, then OK. 9 Double-click the Sine Wave block. 10 For the Sample time parameter, enter 0.05. 11 Click OK. 12 From the File menu, click Save as. Browse to your current working folder, for example, xpc_fortran_test. Enter a filename. For example, enter fortran_atmos_xpc and then click Save. Your next task is to compile Fortran code. See “Compiling Fortran Files” on page 13-7.
13 Incorporating Fortran Code into the xPC Target™ Environment • svml_disp.lib 3 From a DOS prompt, change folder to the working folder and create the object file. For example: ifort /fpp /Qprec /c /nologo /MT /fixed /iface:cref -Ox sfun_atmos_sub.F Your next task is to create a wrapper S-function. See “Creating a C-MEX Wrapper S-Function” on page 13-8. Creating a C-MEX Wrapper S-Function This topic describes how to create a C-MEX wrapper S-function for the Fortran code in sfun_atmos_sub.f.
Step-by-Step Example of Fortran and xPC Target™ Note This topic describes how to create a level 2 Fortran S-function for the fortran_atmos_xpc model. This file is also provided in sfun_atmos.c. 1 Copy the file sfuntmpl_gate_fortran.c to your working folder. This is your C-MEX file for calling into your Fortran subroutine. It works with a simple Fortran subroutine. 2 With a text editor of your choice, open sfuntmpl_gate_fortran.c. 3 Inspect the file. This is a self-documenting file.
13 Incorporating Fortran Code into the xPC Target™ Environment #endif 8 Add a typedef to specify the parameters for the block. For example, typedef enum {T0_IDX=0, P0_IDX, R0_IDX, NUM_SPARAMS } paramIndices; #define T0(S) (ssGetSFcnParam(S, T0_IDX)) #define P0(S) (ssGetSFcnParam(S, P0_IDX)) #define R0(S) (ssGetSFcnParam(S, R0_IDX)) 9 Use the mdlInitializeSizes callback to specify the number of inputs, outputs, states, parameters, and other characteristics of the S-function.
Step-by-Step Example of Fortran and xPC Target™ ssSetOutputPortWidth(S, 1, 3); /* pressure */ ssSetOutputPortWidth(S, 2, 3); /* density */ #if defined(MATLAB_MEX_FILE) EXIT_POINT: #endif return; } 10 Use the mdlInitializeSampleTimes callback to specify the sample rates at which this S-function operates. static void mdlInitializeSampleTimes(SimStruct *S) { ssSetSampleTime(S, 0, INHERITED_SAMPLE_TIME); ssSetOffsetTime(S, 0, 0.
13 Incorporating Fortran Code into the xPC Target™ Environment P[k] = mxGetScalar(P0(S)) * (double) fdelta; rho[k] = mxGetScalar(R0(S)) * (double) fsigma; } } 12 Use the mdlTerminate callback to perform any actions required at termination of the simulation. Even if you do not have any operations here, you must include a stub for this callback.
Step-by-Step Example of Fortran and xPC Target™ • libifcore.lib • libifcoremd.lib • ifconsol.lib • libifportmd.lib • libifport.lib • libmmd.lib • libm.lib • libirc.lib • libmmt.lib • libifcoremt.lib • svml_disp.lib Use the mex command with a C/C++ compiler such as Microsoft Visual C/C++ Version 6.0. This topic assumes that you have created a C-MEX wrapper S-function. See “Creating a C-MEX Wrapper S-Function” on page 13-8. Invoking the mex command requires you to compile the wrapper C file sfun_atmos.c.
13 Incorporating Fortran Code into the xPC Target™ Environment Your next task is to validate the Fortran code and wrapper S-function. See “Validating the Fortran Code and Wrapper S-Function” on page 13-14. Validating the Fortran Code and Wrapper S-Function Validate the generated C-MEX S-function, sfun_atmos.mex. Bind the C-MEX S-function to an S-function block found in the Simulink block library. You can mask the S-function block like any other S-function block to give it a specific dialog box.
Step-by-Step Example of Fortran and xPC Target™ • The build procedure has access to the Fortran run-time libraries (see “Compiling and Linking the Wrapper S-Function” on page 13-12) for the link stage. This topic assumes that you have validated the Fortran code and wrapper S-function (see “Validating the Fortran Code and Wrapper S-Function” on page 13-14). 1 In the MATLAB window, type fortran_atmos_xpc This opens the Simulink model associated with the Atmosphere model.
13 Incorporating Fortran Code into the xPC Target™ Environment This command requires that the application build folder be the current folder (one level below the working folder, xpc_fortran_test). Because of this, all additional dependency designations must start with ..\. Specify all Fortran object files if your model (S-Function blocks) depends on more than one file. For this example, you specify the run-time libraries only once. Your next task is to build and run the xPC Target application.
14 Vector CANape Support This topic describes how to use xPC Target to interface the target PC to the Vector CAN Application Environment (CANape) (http://www.vector-worldwide.com ) using the Universal Calibration Protocol (XCP).
14 Vector CANape® Support Vector CANape In this section... “Introduction” on page 14-2 “xPC Target and Vector CANape Limitations” on page 14-3 Introduction You can use a target PC as an electronic control unit (ECU) for a Vector CANape® system. Using a target PC in this way, a Vector CANape system can read signals and parameters from a target application running on the target PC. The xPC Target software supports polling and event driven modes for data acquisition.
Vector CANape • An XCP server process in the target application that runs on-demand in the background. • A generator that produces A2L (ASAP2) files that Vector CANape can load into the Vector CANape software database. The generated file contains signal and parameter access information for the target application. The following illustrates how the xPC Target and Vector CANape software interact.
14 Vector CANape® Support Configuring the xPC Target and Vector CANape Software In this section... “Setting Up and Building the Model” on page 14-4 “Creating a New Vector CANape Project to Associate with a Particular Target Application” on page 14-6 “Configuring the Vector CANape Device” on page 14-7 “Providing A2L (ASAP2) Files for the Vector CANape Database” on page 14-10 Setting Up and Building the Model Set up your model to work with Vector CANape. This procedure uses the xpcosc model.
Configuring the xPC Target™ and Vector CANape® Software • Target Address — Target IP address for target PC. The default value is getxpcenv(`TcpIpTargetAddress'). Typically, you will want to leave the default entry. Otherwise, enter the TCP/IP address for the target PC. • Server Port — Port for communication between target PC and XCP server. The default value is 5555. This value must be the same as the port number you specify for the Vector MATLAB device.
14 Vector CANape® Support The xPC Target software builds the target application, including an A2L (ASAP2) data file for the target application. 11 On the target PC monitor, look for the following message. These messages indicate that you have successfully built the target application and can now connect to the target with Vector CANape.
Configuring the xPC Target™ and Vector CANape® Software Configuring the Vector CANape Device This procedure describes how to configure the Vector CANape Device to work with your target application. It assumes the following: • You have created a new Vector CANape project to associate with a particular target application. If you have not yet done so, see “Creating a New Vector CANape Project to Associate with a Particular Target Application” on page 14-6.
14 Vector CANape® Support This is the target PC to which you have downloaded the target application. 11 Ensure that the port number is 5555. 12 Click OK. 13 If you have Vector CANape Version 5.6.32.3 and higher, and you want to use the xPC Target software to acquire event driven data: a In the Driver pane of the XCP driver settings window, click Extended driver settings. b Set the ODT_ENTRY_ADDRESS_OPT_DISABLED parameter to Yes.
Configuring the xPC Target™ and Vector CANape® Software Configuring the Location of the A2L (ASAP2) File Use this procedure to configure the location of the target application A2L (ASAP2) file for Vector CANape. This procedure assumes that you have already configured the Vector CANape device and are still in the device configuration dialog. 1 Clear Automatic detection of the database name. 2 At the Database name parameter, click Browse. The Select database for device xPCTarget dialog is displayed.
14 Vector CANape® Support During target application changes, you might need to manually reload the A2L (ASAP2) that is generated by the xPC Target build process. You can do this from the CANape Database editor. Providing A2L (ASAP2) Files for the Vector CANape Database This topic assumes that: • You have set up and built your model to generate data for Vector CANape. If you have not yet done so, see “Setting Up and Building the Model” on page 14-4.
Event Mode Data Acquisition Event Mode Data Acquisition In this section... “Guidelines” on page 14-11 “Limitations” on page 14-11 Guidelines To acquire event mode data rather than polling data, note the following guidelines: • Ensure that you have set the priority of the xcpserver block to the lowest possible. See suggested priority values in “Setting Up and Building the Model” on page 14-4. • The xPC Target software generates events at the base sample rate; this execution rate is the fastest possible.
14 14-12 Vector CANape® Support
15 Frequently Asked Questions • “Overview” on page 15-2 • “BIOS Settings” on page 15-3 • “Booting Issues” on page 15-4 • “Communications” on page 15-6 • “Installation, Configuration, and Build Troubleshooting” on page 15-12 • “General xPC Target Troubleshooting” on page 15-21 • “Getting Updated xPC Target Releases and Help” on page 15-36
15 Frequently Asked Questions Overview This chapter describes guidelines, hints, and tips for questions or issues you might have while using the xPC Target product. Refer to the MathWorks Support xPC Target Web site (http://www.mathworks.com/support/product/XP) for specific troubleshooting solutions. The xPC Target documentation is also available from this site.
BIOS Settings BIOS Settings The BIOS settings of a PC system can affect how the PC works. If you experience problems using the xPC Target software, you should check the system BIOS settings of the target PC. These settings are beyond the control of the xPC Target product. See “The xPC Target Software and the Target PC BIOS” in the xPC Target Getting Started Guide.
15 Frequently Asked Questions Booting Issues In this section... “Is Your Host PC MATLAB Interface Halted?” on page 15-4 “Is Your Target PC Unable to Boot?” on page 15-4 “Is the Target PC Halted?” on page 15-5 Is Your Host PC MATLAB Interface Halted? If your host PC MATLAB interface halts while creating an xPC Target boot disk or image, • Use another disk or CD to create the xPC Target boot disk. • If your host PC has antivirus software, it might conflict with the MATLAB software.
Booting Issues • If you still cannot boot the target PC from a boot disk, you might need to replace the target PC 3.5-inch or CD disk drive. Is the Target PC Halted? If your target PC displays a System Halted message while booting, • Verify that the TcpIp target driver parameter is configured correctly in xPC Target Explorer, recreate the xPC Target boot disk, and use that new disk to boot the target PC. • Ensure that the xPC Target software supports your target PC hardware.
15 Frequently Asked Questions Communications In this section...
Communications • If the communication between the host PC and target PC is TCP/IP, set the host PC network interface card (NIC) card and hub to half-duplex mode. Do not set the mode to full-duplex mode. • If you have an active firewall in your system, you might experience communication errors. For example, MathWorks is aware of build errors that might occur if you try to build and download a model with a thermocouple board (causing a slower initialization time) in a system that contains a firewall.
15 Frequently Asked Questions By default, if the host PC does not get a response from the target PC after downloading a target application and waiting 5 seconds, the host PC software times out. The target PC responds only after downloading and initializing the target application. Usually 5 seconds is enough time to initialize a target application, but in some cases it might not be sufficient. The time to download a target application mostly depends on your I/O hardware.
Communications 5 Rebuild the model. In this case, the host PC waits for about 20 seconds before declaring that a time-out has occurred. Note that it does not take 20 seconds for every download. The host PC polls the target PC about once every second, and if a response is returned, declares success. Only in the case where a download really fails does it take the full 20 seconds.
15 Frequently Asked Questions If you experience this issue, perform the following to try to connect to the target PC: 1 Connect the network cable to Ethernet adapter B. 2 In the MATLAB Command Window, type !arp -d This command removes the association between the target PC address and the hardware address of Ethernet adapter A from the cache of the host PC. This removal allows a new connection (and association) to be made. 3 Change the Ethernet adapter card that the Network Boot option uses.
Communications such an event, you need to reboot the target and reestablish communication between the host PC and target PC. To get yourself back up and running, 1 Remove the reference to the problem driver from the model. 2 Reboot the target PC. 3 At the MATLAB command line, issue xpctargetping to reestablish communications.
15 Frequently Asked Questions Installation, Configuration, and Build Troubleshooting In this section... “Troubleshooting xpctest Results” on page 15-12 “Troubleshooting Build Issues” on page 15-19 Troubleshooting xpctest Results The following are some issues you might encounter while running xpctest to check the xPC Target installation and configuration. xpctest runs eight subtests.
Installation, Configuration, and Build Troubleshooting If you are using a TCP/IP connection and need more help with Test 1, check the following: • Be sure to use only supported Ethernet cards on the target PC. See “Hardware for Network Communication” of the xPC Target Getting Started Guide for further details, including supplied Ethernet cards. • Verify that your hardware is operating correctly. For example, check for faulty network cables and other hardware.
15 Frequently Asked Questions xpctest: Test 3 Fails First, follow the procedure in “Test 3, Reboot Target Using Direct Call” in the xPC Target Getting Started Guide. If you need more help with Test 3, check the following: • Did you get the following error? - ReadFile Error: 6 Older xPC Target releases might receive this error. This message might occur if the host PC initiates communication with the target PC while the target PC is rebooting, but the kernel on the target PC has not yet loaded.
Installation, Configuration, and Build Troubleshooting xpctest: Test 4 Fails First, follow the procedure in the “Test 4, Build and Download Application” in the xPC Target Getting Started Guide. If you need more help with Test 4, check the following: • Verify that a supported compiler is being used. • If the communication between the host PC and target PC is TCP/IP, set the host PC network interface card (NIC) card and hub to half-duplex mode. Do not set the mode to full-duplex mode.
15 Frequently Asked Questions 3 In the Select C compiler field, select the appropriate compiler type (VisualC or Watcom). 4 In the Compiler Path field, enter the root path to the compiler. For example, d:\applications\microsoft visual studio Do not add a terminating back slash (\) at the end of the path. If you still have problems, and you see the following MATLAB Command Window error: ReadFile failed while reading from COM-port 1 Check the state of your target PC.
Installation, Configuration, and Build Troubleshooting 6 Create the boot disk or boot image. 7 Reboot the target PC. 8 Rerun xpctest. If this procedure does not resolve the issue, perform the following: 1 At the MATLAB command line, type updatexpcenv. For example, updatexpcenv 2 Recreate the boot disk or image using xpcbootdisk. 3 Reboot the target PC. 4 Rerun xpctest. xpctest: Test 6 Fails This test runs the basic target object constructor, xpc.
15 Frequently Asked Questions such as 0.001. This change causes the test, and the MATLAB interface itself, to halt. To correct this, set the xpcosc model start time back to 0. xpctest: Test 8 Fails This test executes a target application (xpcosc) on the target PC. This test might fail if you change the xpcosc model (for example, if you remove the Outport block). To correct this, perform one of the following: • Set the model back to the original configuration.
Installation, Configuration, and Build Troubleshooting bottom of the xPC Target block library pop-up window. If the version number is not the one to which you want to upgrade, reinstall the software. Troubleshooting Build Issues The following are some questions you might have when building target applications.
15 Frequently Asked Questions How Can I Build a Model That Contains a CAN Board? The procedure to build a model with CAN blocks differs as follows: • In releases prior to R14SP1 (xPC Target software version 2.6.1), if you want to use the target PC in a CAN network, set up the xPC Target environment for a CAN library. If you do not configure a CAN library into the system, you will get CAN errors when building the target application. In xPC Target software version 2.6.
General xPC Target™ Troubleshooting General xPC Target Troubleshooting In this section...
15 Frequently Asked Questions • Ensure that you have properly configured the driver. • Ensure that you are using the latest version of the software. • Test the hardware using the available diagnostic software included with the I/O board from the manufacturer. • Try a different target PC to verify the behavior. • Report the issue to the MathWorks Support at http://www.mathworks.com/support/contact_us/index.html.
General xPC Target™ Troubleshooting • Spurious CPU overloads — Commonly caused by factors outside of the model design. These overloads are most likely caused by one of the following: - BIOS settings (enabled Advanced Power Management, USB ports in the target PC BIOS, or Plug and Play (PnP) (see “Target PC BIOS” on page 15-24) - System management interrupts (SMIs) Dealing with Small Model Sample Times If the model has too small a sample time, a CPU overload can occur.
15 Frequently Asked Questions Target PC BIOS Undesirable behavior can occur if any of the following BIOS settings are enabled: • Advanced Power Management — Can cause CPU overload. • USB ports — Can cause CPU overload. • Plug-and-Play (PnP) operating system — Prevents PCI devices from working properly. • System Management Interrupts (SMIs) — Can prevent successful operation of real-time software (cause CPU overloads). Enabling any of these properties causes non-real-time behavior from the target PC.
General xPC Target™ Troubleshooting Option Description Default xPCMaxOverloads Number of acceptable overloads. 0 xPCMaxOverloadLen Number of contiguous xPCStartupFlag Same as value of acceptable overloads. If you do not specify this option, the default value is the same as xPCMaxOverlaods. Specify a value that is the same or less than the value for the xPCMaxOverloads option. You should not a use value greater than the xPCMaxOverloads value.
15 Frequently Asked Questions With the TLC options, you can use the following blocks in your model to help keep track of the number of CPU overloads. • Use the xPC Target Get Overload Counter and xPC Target Set Overload Counter blocks to set and keep track of CPU overload numbers. • Use the Pentium Time Stamp Counter block to profile your model. Other Things to Try • Run xpcbench at the MATLAB command line. For example xpcbench('this') This program accurately evaluates your system.
General xPC Target™ Troubleshooting How Can I Reduce the TET in My Application? To reduce the Task Execution Time (TET) in your application: • Use fewer scopes in the model. • Do not log the TET values for the application. To disable TET logging, clear the Log Task Execution Time check box. in the Data Logging options section of the Simulink model window Simulation > Configuration Parameters > xPC Target options pane. • Do not log output for the application.
15 Frequently Asked Questions If you have or want to use multiple boards of a particular type in your system, ensure that the I/O drive supports multiple boards. Refer to one of the following: • xPC Target I/O Reference • xPC Target Interactive Hardware Selection Guide (http://www.mathworks.com/support/product/XP/productnews /interactive_guide/xPC_Target_Interactive_Guide.
General xPC Target™ Troubleshooting • Number of I/O channels Why Is My Requested xPC Target Sample Time Different from the Measured Sample Time? You might notice that the sample time you request does not equal the actual sample time you measure from your model. This difference depends on your hardware. Your model sample time is as close to your requested time as the hardware allows. However, hardware does not allow infinite precision in setting the spacing between the timer interrupts.
15 Frequently Asked Questions previously calculated value of 0.25%, there is a difference of 0.04% from the expected value. If you want to further refine the measured deviation for your hardware, assume the following: • Output board that generates a 50 Hz sine wave (expected signal) • Sample time of 1/10200 • Measured signal of 50.002 Hz 1/10200 seconds X 1.193 x 106 ticks/seconds = 116.96 ticks Round this number to the nearest whole number of 117 ticks. The resulting frequency is then (116.
General xPC Target™ Troubleshooting available space on the disk. The signal data will most likely be corrupted and irretrievable. You should delete the signal data file and reboot the xPC Target system. To prevent this occurrence, monitor the size of the signal data file as the scope acquires data. Refer to the MathWorks Support xPC Target Web site (http://www.mathworks.com/support/product/XP) for additional information.
15 Frequently Asked Questions Can I Create a Stand-Alone xPC Target Application to Interact with a Target Application? Yes. You can use either the xPC Target API dynamic link library (DLL) or the xPC Target component object model (COM) API library to create custom stand-alone applications to control a real-time application running on the target PC. To deploy these stand-alone applications, you must have the xPC Target Embedded Option license.
General xPC Target™ Troubleshooting For example, if a model has a stop time of 2.4 and a step size of 1, the Real-Time Workshop software adjusts the stop time of the model to 2 at compilation. If you change the step size to .6 but do not recompile the code, the expected number of steps is 4, but the actual number of steps is 3. This is because the Real-Time Workshop software still uses the adjusted stop time of 2.
15 Frequently Asked Questions • If the blocks of interest have special characters, retrieve the mangled name with tg.showsignals='on' or tg.showparam = 'on'. For example, if carriage return '\n' is part of the block path, the mangled name returns with carriage returns replaced by spaces. How Do I Handle Register Rollover for xPC Target Encoder Blocks? Encoder boards have a fixed size counter register of 16 bits, 24 bits, or 32 bits.
General xPC Target™ Troubleshooting • An extended counter takes the output of an encoder block and provides a count that is not limited by register size. For an n-bit register, this counter should be able to count values greater than 2^(n-1). Keep the following requirements in mind when using these sample blocks: • Some driver blocks allow an initial starting value to be loaded into the register. You must pass this value to the rollover blocks to adjust for that offset.
15 Frequently Asked Questions Getting Updated xPC Target Releases and Help In this section... “How to Get Updated xPC Target Releases” on page 15-36 “Are You Working with a New xPC Target Release?” on page 15-36 “Refer to the MathWorks Support Web Site” on page 15-37 “Refer to the Documentation” on page 15-37 How to Get Updated xPC Target Releases 1 MATLAB Command Window Start >Links and Targets > xPC Target > Product Page (Web).
Getting Updated xPC Target™ Releases and Help Refer to the MathWorks Support Web Site This chapter contains general xPC Target troubleshooting tips. For other xPC Target solutions and general guidelines, see the following MathWorks Web site resources: • MATLAB Central File Exchange for xPC Target Product. • MathWorks Support xPC Target Web site (http://www.mathworks.com/support/product/XP). The xPC Target documentation is also available from this site.
15 15-38 Frequently Asked Questions
16 Target PC Command-Line Interface Reference
16 Target PC Command-Line Interface Reference Target PC Commands In this section...
Target PC Commands Target PC Command start Description and Syntax MATLAB Equivalent Start the target application currently loaded on the target PC. tg.start or +tg Syntax: start stop Stop the target application currently running on the target PC. tg.stop or -tg Syntax: stop reboot Reboot the target PC. tg.
16 Target PC Command-Line Interface Reference Target PC Command Description and Syntax MATLAB Equivalent Syntax: setpar parameter_index = floating_point_number stoptime Enter a new stop time. Use inf to run the target application until you manually stop it or reset the target PC. tg.stoptime = number Syntax: stoptime = floating_point_number sampletime Enter a new sample time. tg.
Target PC Commands the difference between a signal index (0, 1, . . .) and a signal name (S0, S1, . . .). The following table lists the syntax for the target commands that you can use on the target PC. The MATLAB equivalent syntax is shown in the right column. The target object name tg and the scope object name sc are used as an example for the MATLAB methods. Target PC Command Description and Syntax MATLAB Equivalent addscope addscope scope_index addscope tg.addscope(scope_index) tg.
16 Target PC Command-Line Interface Reference Target PC Command Description and Syntax MATLAB Equivalent ylimit ylimit scope_index ylimit scope_index = auto ylimit scope_index = num1, num2 sc.YLimit sc.YLimit='auto' sc.YLimit([num1 num2]) grid grid scope_index on grid scope_index off sc.Grid = on sc.Grid = off Scope Object Property Commands When you use the target PC command-line interface, scope object properties are limited to those shown in the following table.
Target PC Commands Target PC MATLAB Equivalent triggermode scope_index = 0, freerun, 1, software, 2, signal, 3, scope sc.TriggerMode = 'freerun', 'software', 'signal', 'scope' numprepostsamples scope_index = number sc.NumPrePostSamples = number triggersignal scope_index = signal_index sc.TriggerSignal = signal_index triggersample scope_index = number sc.TriggerSample = number triggerlevel scope_index = number sc.
16 Target PC Command-Line Interface Reference Target PC Command setvar Description and Syntax Set a variable to a value. Later you can use that variable to do a macro expansion. MATLAB Equivalent None Syntax: setvar variable_name = target_pc_command For example, you can type setvar aa=startscope 2, setvar bb=stopscope 2. getvar Display the value of a variable. None Syntax: getvar variable_name delvar Delete a variable. None Syntax: delvar variable_name delallvar Delete all variables.
17 Function Reference Software Environment (p. 17-2) Define software and hardware environment of host and target PCs GUI (p. 17-3) Open xPC Target ancillary GUIs Test (p. 17-4) Run tests from MATLAB Command Window Target Application Objects (p. 17-5) Control target application on target PC from host PC Scope Objects (p. 17-7) Control scopes on target PC File and File System Objects (p.
17 Function Reference Software Environment 17-2 getxpcenv List environment properties assigned to MATLAB variable setxpcenv Change xPC Target environment properties updatexpcenv Change current environment properties to new properties xpcbootdisk Create xPC Target boot disk or DOS Loader files and confirm current environment properties xpcbytes2file Generate file suitable for use by From File block xpcwwwenable Disconnect target PC from current client application
GUI GUI xpcexplr Open xPC Target Explorer xpctargetspy Open Real-Time xPC Target Spy window on host PC 17-3
17 Function Reference Test 17-4 getxpcinfo Retrieve diagnostic information to help troubleshoot configuration issues getxpcpci Determine which PCI boards are installed in target PC xpctargetping Test communication between host and target PCs xpctest Test xPC Target installation
Target Application Objects Target Application Objects addscope Create scopes close Close serial port connecting host PC with target PC delete Remove target object get (target application object) Return target application object property values getlog All or part of output logs from target object getparam Value of target object parameter index getparamid Parameter index from parameter list getparamname Block path and parameter name from index list getscope Scope object pointing to scope def
17 Function Reference set (target application object) Change target application object property values setparam Change writable target object parameters start (target application object) Start execution of target application on target PC stop (target application object) Stop execution of target application on target PC targetping Test communication between host and target computers unload Remove current target application from target PC xpc Call target object constructor, xpctarget.
Scope Objects Scope Objects addsignal Add signals to scope represented by scope object get (scope object) Return property values for scope objects remsignal Remove signals from scope represented by scope object set (scope object) Change property values for scope objects start (scope object) Start execution of scope on target PC stop (scope object) Stop execution of scope on target PC trigger Software-trigger start of data acquisition for scope(s) 17-7
17 Function Reference File and File System Objects Directories (p. 17-8) Manage file system and FTP objects FTP (p. 17-8) Manage FTP objects File System (p. 17-8) Manage file system objects Directories cd Change folder on target PC dir List contents of current folder on target PC get (ftp) Retrieve copy of requested file from target PC mkdir Make folder on target PC pwd Current folder path of target PC rmdir Remove folder from target PC xpctarget.
File and File System Objects fopen Open target PC file for reading fread Read open target PC file fwrite Write binary data to open target PC file getfilesize Size of file on target PC removefile Remove file from target PC selectdrive Select target PC drive 17-9
17 Function Reference xPC Target Environment Collection Object 17-10 Add (env collection object) Add new xPC Target environment collection object get (env collection object) Return target object collection environment property values get (env object) Return target environment property values getTargetNames (env collection object) Retrieve xPC Target environment object names Item (env collection object) Retrieve specific xPC Target environment (env) object makeDefault (env collection object) S
xPC Target™ Utilities xPC Target Utilities macaddr Convert string-based MAC address to vector-based one readxpcfile Interpret raw data from xPC Target file format 17-11
17 17-12 Function Reference
18 Functions
Add (env collection object) Purpose Add new xPC Target environment collection object Syntax MATLAB command line env_collection_object.Add Description Method of xpctarget.targets objects. Add creates an xPC Target environment collection object on the host PC. Examples Add a new xPC Target environment collection object to the system. Assume that tgs represents the environment collection object. tgs=xpctarget.
addscope Purpose Create scopes Syntax MATLAB command line Create a scope and scope object without assigning to a MATLAB variable. addscope(target_object, scope_type, scope_number) target_object.addscope(scope_type, scope_number) Create a scope, scope object, and assign to a MATLAB variable scope_object = addscope(target_object, scope_type, scope_number) scope_object = target_object.
addscope 10 scopes of type target and host, and eight scopes of type file, for a maximum of 28 scopes. If you try to add a scope with the same index as an existing scope, the result is an error. A scope acquires data from the target application and displays that data on the target PC, uploads the data to the host PC, or stores that data in a file in the target PC file system. All scopes of type target, host, or file run on the target PC.
addscope or sc1 = tg.addscope('target',1) Create a scope with the method addscope and then create a scope object, corresponding to this scope, using the method getscope. A target scope is created on the target PC with an index of 1, and a scope object is created on the host PC, but it is not assigned to a variable. The target object property Scopes is changed from No scopes defined to 1. addscope(tg,'target',1) or tg.addscope('target',1) sc1 = getscope(tg,1) or sc1 = tg.
addsignal Purpose Add signals to scope represented by scope object Syntax MATLAB command line addsignal(scope_object_vector, signal_index_vector) scope_object_vector.addsignal(signal_index_vector) Target command line addsignal scope_index = signal_index, signal_index, . . . Arguments Description scope_object_vector Name of a single scope object or the name of a vector of scope objects. signal_index_vector For one signal, use a single number.
addsignal Display a list of properties and values for the scope object sc1 with the property Signals, as shown below. sc1.Signals Signals = 1 0 : Signal Generator : Integrator1 Another way to add signals without using the method addsignal is to use the scope object method set. set(sc1,'Signals', [0,1]) or sc1.set('signals',[0,1] Or, to directly assign signal values to the scope object property Signals, sc1.signals = [0,1] See Also The xPC Target scope object methods remsignal and set (scope object).
cd Purpose Change folder on target PC Syntax MATLAB command line cd(file_obj,target_PC_dir) file_obj.cd(target_PC_dir) Arguments file_obj Name of the xpctarget.ftp or xpctarget.fs object. target_PC_dir Name of the target PC folder to change to. Description Method of xpctarget.fsbase, xpctarget.ftp, and xpctarget.fs objects. From the host PC, changes folder on the target PC. Examples Change folder from the current to one named logs for the file system object fsys. cd(fsys,logs) or fsys.
close Purpose Close serial port connecting host PC with target PC Syntax MATLAB command line close(target_object) target_object.close Arguments Description target_object Name of a target object. close closes the serial connection between the host PC and a target PC. If you want to use the serial port for another function without quitting the MATLAB window – for example, a modem – use this function to close the connection.
delete Purpose Remove target object Syntax MATLAB command line delete(target_object) target_object.delete Arguments Description target_object Name of a target object. Use this method to completely remove the target object. If there are any scopes still associated with the target, this method removes all those scope objects as well.
dir Purpose List contents of current folder on target PC Syntax MATLAB command line dir(file_obj) Arguments Description file_obj Name of the xpctarget.ftp or xpctarget.fs object. Method of xpctarget.fsbase, xpctarget.ftp, and xpctarget.fs objects. From the host PC, lists the contents of the current folder on the target PC. To get the results in an M-by-1 structure, use a syntax like ans=dir(file_obj).
dir • isdir — Logical value indicating that the object is (1) or is not (0) a folder Examples List the contents of the current folder for the file system object fsys. You can also list the contents of the current folder for the FTP object f.
diskinfo Purpose Information about target PC drive Syntax MATLAB command line diskinfo(filesys_obj,target_PC_drive) filesys_obj.diskinfo(target_PC_drive) Arguments Description filesys_obj Name of the xpctarget.fs file system object. target_PC_drive Name of the target PC drive for which to return information. Method of xpctarget.fs objects. From the host PC, returns disk information for the specified target PC drive.
diskinfo Examples Return disk information for the target PC C:\ drive for the file system object fsys. diskinfo(fsys,'C:\') or fsys.diskinfo('C:\') ans = Label: 'SYSTEM ' DriveLetter: 'C' Reserved: '' SerialNumber: 1.
fclose Purpose Close open target PC file(s) Syntax MATLAB command line fclose(filesys_obj,file_ID) filesys_obj.fclose(file_ID) Arguments filesys_obj Name of the xpctarget.fs file system object. file_ID File identifier of the file to close. Description Method of xpctarget.fs objects. From the host PC, closes one or more open files in the target PC file system (except standard input, output, and error).
fc422mexcalcbits Purpose Calculate parameter values for Fastcom 422/2-PCI board Syntax MATLAB command line [a b ] = fc422mexcalcbits(frequency) [a b df] = fc422mexcalcbits(frequency) Arguments frequency Desired baud rate for the board [a b] = fc422mexcalcbits(frequency) accepts a baud rate (in units of baud/second) and converts this value into two parameters a b. You must enter these values for the parameter Clock bits of the Fastcom 422/2-PCI driver clock.
fileinfo Purpose Target PC file information Syntax MATLAB command line fileinfo(filesys_obj,file_ID) filesys_obj.fileinfo(file_ID) Arguments filesys_obj Name of the xpctarget.fs file system object. file_ID File identifier of the file for which to get file information. Description Method of xpctarget.fs objects. From the host PC, gets the information for the file associated with file_ID.
filetable Purpose Information about open files in target PC file system Syntax MATLAB command line filetable(filesys_obj) filesys_obj.filetable Arguments filesys_obj Name of the xpctarget.fs file system object. Description Method of xpctarget.fs objects. From the host PC, displays a table of the open files in the target PC file system. You cannot have more than eight files open in the file system.
filetable fsys.fclose(h1); See Also xPC Target file object methods fopen and fclose.
fopen Purpose Open target PC file for reading Syntax MATLAB command line file_ID file_ID file_ID file_ID Arguments Description = fopen(file_obj,'file_name') = file_obj.fopen('file_name') = fopen(file_obj,'file_name',permission) = file_obj.fopen('file_name',permission) file_obj Name of the xpctarget.fs object. 'file_name' Name of the target PC to open. permission Values are 'r', 'w', 'a', 'r+', 'w+', or 'a+'. This argument is optional with 'r' as the default value. Method of xpctarget.
fopen Open the file for reading and writing. Initially, the file pointer is at the beginning of the file. The method does nothing if the file does not already exist. • 'w+' Open the file for reading and writing. The method empties the file first, if the file already exists and has content, and places the file pointer at the beginning of the file. The method creates the file if it does not already exist. • 'a+' Open the file for reading and appending to the file.
fread Purpose Read open target PC file Syntax MATLAB command line A A A A Arguments Description = = = = fread(file_obj,file_ID) file_obj.fread(file_ID) fread(file_obj, file_ID, offset, numbytes) file_obj.fread(file_ID, offset, numbytes) file_obj Name of the xpctarget.fs object. file_ID File identifier of the file to read. offset Position from the beginning of the file from which fread can start to read. numbytes Maximum number of bytes fread can read. Method of xpctarget.fs objects.
fread length(A) might be less than the number of bytes requested if that number of bytes are not currently available. It is zero if the operation reaches the end of the file. Examples Open the file data.dat in the target PC file system object fsys. Assign the resulting file handle to a variable for reading. h = fopen(fsys,'data.dat') or fsys.fopen('data.dat') ans = 2883584 d = fread(h); This reads the file data.dat and stores all of the contents of the file to d.
fwrite Purpose Write binary data to open target PC file Syntax MATLAB command line fwrite(file_obj,file_ID,A) file_obj.fwrite(file_ID,A) Arguments file_obj Name of the xpctarget.fs object. file_ID File identifier of the file to write. A Elements of matrix A to be written to the specified file. Description Method of xpctarget.fs objects. From the host PC, writes the elements of matrix A to the file identified by file_ID. The data is written to the file in column order.
fwrite See Also xPC Target file object methods fclose, fopen, and fread. MATLAB fwrite function.
get (env collection object) Purpose Return target object collection environment property values Syntax MATLAB command line get(env_collection_object, 'env_collection_object_property') Arguments Description env_collection_object Name of a collection of target objects. 'env_collection_object_ property' Name of a target object environment property. get gets the values of environment properties for a collection of target objects.
get (env collection object) Examples Property Description Writable DefaultTarget Contains an instance of the default target environment object (xpctarget.env). No FloppyDrive Allows you to set the 3.5-inch drive letter to the one designated by your target PC. By default, FloppyDrive is set to a:. Set this property to b: only if the target PC designates it. As necessary, set this value before creating a boot disk. Valid values are 'a:' and 'b:'.
get (env collection object) See Also xPC Target target object environment method set (env collection object) Built-in MATLAB functions get and set 18-28
get (env object) Purpose Return target environment property values Syntax MATLAB command line get(env_object) get(env_object, 'property_name1', 'property_value1', 'property_name2', 'property_value2', . . .) env_object.get('property_name1', 'property_value1') get(env_object, property_name_vector, property_value_vector) env_object.property_name = property_value Arguments Description env_object Name of a target environment object. 'property_name' Name of a target environment object property.
get (env object) Environment Property Description Writable Name Target PC name. Yes HostTargetComm Values are 'RS232' and 'TcpIp'. Yes From the xPC Target Explorer window Host target communication list, select either RS232 or TCP/IP. If you select RS232, you also need to set the property RS232HostPort. If you select TCP/IP, then you also need to set all properties that start with TcpIp. TargetRAMSizeMB Values are 'Auto' and 'Manual'.
get (env object) Environment Property Description Writable MaxModelSize BootFloppy and DOSLoader modes ignore this value. Yes Values are '1MB', '4MB', and '16MB'. From the xPC Target Explorer window Maximum model size list, select either 1 MB, 4 MB, or 16 MB. This value is unavailable for BootFloppy or DOSLoader modes. Choosing the maximum model size reserves the specified amount of memory on the target PC for the target application.
get (env object) Environment Property Description Writable TargetScope Values are 'Disabled' and 'Enabled'. Yes From the xPC Target Explorer window Enable target scope list, select either Enabled or Disabled. The property TargetScope is set by default to Enabled. If you set TargetScope to Disabled, the target PC displays information as text. To use all the features of the target scope, you also need to install a keyboard on the target PC.
get (env object) Environment Property Description Writable CDBootImageLocation Location of cdboot.iso file for creation of CD target boot disk. Yes EmbeddedOption Values are 'Disabled' and 'Enabled'. This property is read only. Yes Note that the xPC Target Embedded Option product is enabled only if you purchase an additional license. SecondaryIDE Values are 'off' and 'on'. Set this value to 'on' only if you want to use the disks connected to a secondary IDE controller.
get (env object) Environment Property Description Writable TcpIpTargetAddress Value is 'xxx.xxx.xxx.xxx'. Yes In the xPC Target Explorer window Target PC IP address box, enter a valid IP address for your target PC. Ask your system administrator for this value. For example, 192.168.0.10. TcpIpTargetPort Value is 'xxxxx'. Yes In the xPC Target Explorer window TcpIp target port box, enter a value greater than 20000. This property is set by default to 22222 and should not cause any problems.
get (env object) Environment Property Description Writable TcpIpGateway Value is 'xxx.xxx.xxx.xxx'. Yes In the xPC Target Explorer window TcpIp gateway address box, enter the IP address for your gateway. This property is set by default to 255.255.255.255, which means that a gateway is not used to connect to the target PC.
get (env object) Environment Property Description Writable TcpIpTargetBusType Values are 'PCI' and 'ISA'. Yes From the xPC Target Explorer window TcpIp target bus type list, select either PCI or ISA. This property is set by default to PCI, and determines the bus type of your target PC. You do not need to define a bus type for your host PC, which can be the same or different from the bus type in your target PC.
get (env object) Environment Property Description Writable another IRQ and make the corresponding changes to your jumper settings. TcpIpTargetISAMem Port Value is '0xnnnn'. Yes If you are using an ISA bus Ethernet card, you must enter values for the properties TcpIpISAMemPort and TcpIpISAIRQ. The values of these properties must correspond to the jumper settings or ROM settings on your ISA bus Ethernet card.
get (env object) See Also 18-38 set (env object)
get (ftp) Purpose Retrieve copy of requested file from target PC Syntax MATLAB command line get(file_obj,file_name) file_obj.get(file_name) Arguments file_obj Name of the xpctarget.ftp object. file_name Name of a file on the target PC. Description Method of xpctarget.ftp objects. Copies the specified filename from the target PC to the current folder of the host PC. file_name must be either a fully qualified filename on the target PC, or located in the current folder of the target PC.
get (scope object) Purpose Return property values for scope objects Syntax MATLAB command line get(scope_object_vector) get(scope_object_vector, 'scope_object_property') get(scope_object_vector, scope_object_property_vector) Arguments target_object Name of a target object. scope_object_vector Name of a single scope or name of a vector of scope objects. scope_object_property Name of a scope object property.
get (scope object) Property Description Writable box to have the scope of type 'File' collect data up to Number of samples, then stop. If the named signal data file already exists when you start the target application, the xPC Target software overwrites the old data with the new signal data. For scopes of type 'Host' or 'Target', this parameter has no effect. To use the DynamicFileName property, set AutoRestart to 'on' first. Data Contains the output data for a single data package from a scope.
get (scope object) Property Description Writable name, including the specifier, cannot exceed eight characters. For scopes of type 'Host' or 'File', this parameter has no effect. Filename Provide a name for the file to contain the signal data. By default, the target PC writes the signal data to a file named C:\data.dat for scope blocks. Note that for scopes of type 'File' created through the MATLAB interface, there is no name initially assigned to FileName.
get (scope object) Property Description Writable beginning and overwrites the first file name in the series. If you do not retrieve the data from existing files before they are overwritten, the data is lost. For scopes of type 'Host' or 'Target', this parameter has no effect. Grid Values are 'on' and 'off'. Yes For scopes of type 'Host' or 'File', this parameter has no effect. MaxWriteFileSize Provide the maximum size of Filename, in bytes. This value must be a multiple of WriteSize.
get (scope object) Property Description Writable when the file is closed and not during each file write operation. This mode is faster, but if the system crashes before the file is closed, the file system might not know the actual file size (the file contents, however, will be intact). For scopes of type Host, this parameter has no effect. NumPrePostSamples For scopes of type 'Host' or 'Target', this parameter is the number of samples collected before or after a trigger event. The default value is 0.
get (scope object) Property Description Writable ScopeId A numeric index, unique for each scope. No Signals List of signal indices from the target object to display on the scope. No Status Indicate whether data is being acquired, the scope is waiting for a trigger, the scope has been stopped (interrupted), or acquisition is finished. Values are 'Acquiring', 'Ready for being Triggered', 'Interrupted', and 'Finished'. No Time Contains the time data for a single data package from a scope.
get (scope object) Property Description Writable As a special case, setting TriggerSample to -1 means that the current scope is triggered at the end of the acquisition cycle of the triggering scope. Thus, the first sample of the triggering scope is acquired one sample after the last sample of the triggering scope. 18-46 TriggerScope If TriggerMode is 'Scope', identifies the scope to use for a trigger. A scope can be set to trigger when another scope is triggered.
get (scope object) Property Description Writable WriteSize Enter the block size, in bytes, of the data chunks. This parameter specifies that a memory buffer, of length number of samples (NumSamples), collect data in multiples of WriteSize. By default, this parameter is 512 bytes, which is the typical disk sector size. Using a block size that is the same as the disk sector size provides optimal performance.
get (scope object) See Also The xPC Target scope object method set (scope object). The target object methods set (target application object). The built-in MATLAB functions get and set.
get (target application object) Purpose Return target application object property values Syntax MATLAB command line get(target_object, 'target_object_property') Arguments target_object Name of a target object. 'target_object_property' Name of a target object property. Description get gets the value of readable target object properties from a target object. The properties for a target object are listed in the following table.
get (target application object) Property Description Writable • Asynchronous interruptions. • Parameter updating latency (if the Double buffer parameter changes parameter in the xPC Target options node using the model Simulation > Configuration Parameters dialog box). Note that the TET is not the only consideration in determining the minimum achievable sample time.
get (target application object) Property Description Writable LogMode Controls which data points are logged: Yes • Time-equidistant logging. Logs a data point at every time interval. Set value to 'Normal'. • Value-equidistant logging. Logs a data point only when an output signal from the OutputLog changes by a specified value (increment). Set the value to the difference in signal values.
get (target application object) 18-52 Property Description Writable Mode Type of Real-Time Workshop code generation. Values are 'Real-Time Singletasking', 'Real-Time Multitasking', and 'Accelerate'. The default value is 'Real-Time Singletasking'. Even if you select 'Real-Time Multitasking', the actual mode can be 'Real-Time Singletasking'. This happens if your model contains only one or two tasks and the sample rates are equal. No NumLogWraps The number of times the circular buffer wrapped.
get (target application object) Property Description Writable Parameters List of tunable parameters. This list is visible only when ShowParameters is set to 'on': No • Property value. Value of the parameter in a Simulink block. • Type. Data type of the parameter. Always double. • Size. Size of the parameter. For example, scalar, 1-by-2 vector, or 2-by-3 matrix. • Parameter name. Name of a parameter in a Simulink block. • Block name. Name of a Simulink block. SampleTime Time between samples.
get (target application object) Property Description Writable ShowSignals Flag set to view or hide the list of signals from your Simulink blocks. This list is shown when you display the properties for a target object. Values are 'on' and 'off'. Yes Signals List of viewable signals. This list is visible only when ShowSignals is set to 'on'. No • Property name. S0, S1. . . • Property value. Value of the signal. • Block name. Name of the Simulink block the signal is from.
get (target application object) Property Description Writable TETLog Storage in the MATLAB workspace for a vector containing task execution times during execution of the target application. No To enable logging of the TET, you need to select the Log Task Execution Time check box located at Simulation menu Configuration Parameters > xPC Target options pane. TimeLog Storage in the MATLAB workspace for the time or t-vector logged during execution of the target application.
getfilesize Purpose Size of file on target PC Syntax MATLAB command line getfilesize(file_obj,file_ID) file_obj.getfilesize(file_ID) Arguments file_obj Name of the xpctarget.fs object. file_ID File identifier of the file to get the size of. Description Method of xpctarget.fs objects. From the host PC, gets the size (in bytes) of the file identified by the file_ID file identifier on the target PC file system. Use the xPC Target file object method fopen to open the file system object.
getlog Purpose All or part of output logs from target object Syntax MATLAB command line log = getlog(target_object, 'log_name', first_point, number_samples, decimation) Arguments log User-defined MATLAB variable. 'log_name' Values are TimeLog, StateLog, OutputLog, or TETLog. This argument is required. first_point First data point. The logs begin with 1. This argument is optional. Default is 1. number_samples Number of samples after the start time. This argument is optional.
getparam Purpose Value of target object parameter index Syntax MATLAB command line getparam(target_object, parameter_index) Arguments target_object Name of a target object. The default name is tg. parameter_index Index number of the parameter. Description getparam returns the value of the parameter associated with parameter_index. Examples Get the value of parameter index 5.
getparamid Purpose Parameter index from parameter list Syntax MATLAB command line getparamid(target_object, 'block_name', 'parameter_name') Arguments target_object Name of a target object. The default name is tg. 'block_name' Simulink block path without model name. 'parameter_name' Name of a parameter within a Simulink block. Description getparamid returns the index of a parameter in the parameter list based on the path to the parameter name.
getparamid Troubleshooting chapter question “Why Does the getparamid Function Return Nothing?” on page 15-33.
getparamname Purpose Block path and parameter name from index list Syntax MATLAB command line getparamname(target_object, parameter_index) Arguments target_object Name of a target object. The default name is tg. parameter_index Index number of the parameter. Description getparamname returns two argument strings, block path and parameter name, from the index list for the specified parameter index. Examples Get the block path and parameter name of parameter index 5.
getscope Purpose Scope object pointing to scope defined in kernel Syntax MATLAB command line scope_object_vector = getscope(target_object, scope_number) scope_object = target_object.getscope(scope_number) Arguments target_object Name of a target object. scope_number_vector Vector of existing scope indices listed in the target object property Scopes. The vector can have only one element. scope_object MATLAB variable for a new scope object vector. The vector can have only one scope object.
getscope the target PC. To change the number of samples, you need to create a scope object and then change the scope object property NumSamples. sc1 = getscope(tg,1) or sc1 = tg.getscope(1) sc1.NumSample = 500 The 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 target object has more than one scope, it create a vector of scope objects.
getsignal Purpose Value of target object signal index Syntax MATLAB command line getsignal(target_object, signal index) Arguments target_object Name of a target object. The default name is tg. signal_index Index number of the signal. This can be a value of up to 1000 elements. Description getsignal returns the value of the signal associated with signal_index. Examples Get the value of signal index 2. getsignal(tg, 2) ans = -3.
getsignalid Purpose Signal index or signal property from signal list Syntax MATLAB command line getsignalid(target_object, 'signal_name') tg.getsignalid('signal_name') Arguments target_object Name of an existing target object. signal_name Enter the name of a signal from your Simulink model. For blocks with a single signal, the signal_name is equal to the block_name. For blocks with multiple signals, the xPC Target software appends S1, S2 ... to the block_name.
getsignalidsfromlabel Purpose Return vector of signal indices Syntax MATLAB command line getsignalidsfromlabel(target_object, signal_label) target_object.getsignalidsfromlabel(signal_label) Arguments Description target_object Name of a target object. The default name is tg. signal_label Signal label (from Simulink model). getsignalidsfromlabel returns a vector of one or more signal indices that are associated with the labeled signal, signal_label.
getsignallabel Purpose Return signal label Syntax MATLAB command line getsignallabel(target_object, signal_index) target_object.getsignallabel(signal_index) Arguments Description target_object Name of a target object. The default name is tg. signal_index Index number of the signal. getsignallabel returns the signal label for the specified signal index, signal_index. signal_label.
getsignalname Purpose Signal name from index list Syntax MATLAB command line getsignalname(target_object, signal_index) target_object.getsignalname(signal_index) Arguments target_object Name of a target object. The default name is tg. signal_index Index number of the signal. Description getparamname returns one argument string, signal name, from the Examples Get the signal name of signal ID 2. index list for the specified signal index.
getTargetNames (env collection object) Purpose Retrieve xPC Target environment object names Syntax MATLAB command line env_collection_object.getTargetNames Description Method of xpctarget.targets objects. getTargetNames retrieves the names of all existing xPC Target environment collection objects from the xpctarget.targets class. Examples Retrieve the names of all xPC Target environment collection objects in the system. Assume that tgs represents the target object collection environment.
getxpcenv Purpose List environment properties assigned to MATLAB variable Syntax MATLAB command line getxpcenv Description Function to list environment properties. This function displays, in the MATLAB Command Window, the property names, the current property values, and the new property values set for the xPC Target environment.
getxpcenv Environment Property Description EmbeddedOption Values are 'Disabled' and 'Enabled'. This property is read only. Note that the xPC Target Embedded Option product is enabled only if you purchase an additional license. EthernetIndex Value is ’n’, where n indicates the index number for the Ethernet card on a target PC. Note that the (n-1)th Ethernet card on the target PC has an index number 'n'. The default index number is 0.
getxpcenv Environment Property Description enough memory for the target application and creates an error. Note, you cannot build a 16 MB target application to run in StandAlone mode. MulticoreSupport Values are 'off' and 'on'. If your target PC has multicore processors, set this value to 'on' to take advantage of these processors for background tasks. Otherwise, set this value to 'off'. Name Target PC name. NonPentiumSupport Values are 'off' (default) and 'on'.
getxpcenv Environment Property Description SecondaryIDE Values are 'off' and 'on'. Set this value to 'on' only if you want to use the disks connected to a secondary IDE controller. If you do not have disks connected to the secondary IDE controller, leave this value set to 'off'. TargetBoot Values are 'BootFloppy', 'CDBoot', 'DOSLoader', 'NetworkBoot', and 'StandAlone'.
getxpcenv Environment Property Description memory up to 64 MB. If the target PC does not contain more than 64 MB of RAM, or you do not want to use more than 64 MB, select Auto. If the target PC has more than 64 MB of RAM, and you want to use more than 64 MB, select Manual, and enter the amount of RAM installed in the target PC. TargetScope Values are 'Disabled' and 'Enabled'. From the xPC Target Explorer window Enable target scope list, select either Enabled or Disabled.
getxpcenv Environment Property Description TcpIpSubNetMask Value is 'xxx.xxx.xxx.xxx'. In the xPC Target Explorer window LAN subnet mask address text box, enter the subnet mask of your LAN. Ask your system administrator for this value. For example, your subnet mask could be 255.255.255.0. TcpIpTargetAddress Value is 'xxx.xxx.xxx.xxx'. In the xPC Target Explorer window Target PC IP address box, enter a valid IP address for your target PC. Ask your system administrator for this value. For example, 192.
getxpcenv Environment Property Description TcpIpTargetDriver Values are 'NE2000', 'SMC91C9X', 'I82559', 'RTLANCE', 'R8139', '3C90x', and 'NS83815'. From the xPC Target Explorer window TcpIp target driver list, select NE2000, SMC91C9X, I82559, RTLANCE, R8139, 3C90x, or NS83815. The Ethernet card provided with the system uses the NE2000 driver. TcpIpTargetPort Value is 'xxxxx'. In the xPC Target Explorer window TcpIp target port box, enter a value greater than 20000.
getxpcenv Environment Property Description TcpIpTargetISAMemPort Value is '0xnnnn'. If you are using an ISA bus Ethernet card, you must enter values for the properties TcpIpISAMemPort and TcpIpISAIRQ. The values of these properties must correspond to the jumper settings or ROM settings on your ISA bus Ethernet card. On your ISA bus card, assign an IRQ and I/O port base address by moving the jumpers on the card. Set the I/O port base address to around 0x300.
getxpcinfo Purpose Retrieve diagnostic information to help troubleshoot configuration issues Syntax MATLAB command line getxpcinfo getxpcinfo('-a') Arguments Description '-a' Appends diagnostic information to an existing xpcinfo.txt file. If one does not exist, this function creates the file in the current folder. getxpcinfo returns diagnostic information for troubleshooting xPC Target configuration issues. This function generates and saves the information in the xpcinfo.
getxpcpci Purpose Determine which PCI boards are installed in target PC Syntax MATLAB command line getxpcpci(target_object, 'type_of_boards') getxpcpci(target_object, 'verbose') Arguments Description target_object Variable name to reference the target object. type_of_boards Values are no arguments, 'all', and 'supported'. verbose Argument to include the base address register information in the PCI device display.
getxpcpci which have to be provided to a driver block dialog box before the model build process. Examples The following example displays the installed PCI devices, not only the devices supported by the xPC Target block library. This includes graphics controllers, network cards, SCSI cards, and even devices that are part of the motherboard chip set (for example, PCI-to-PCI bridges).
getxpcpci pcidevs = getxpcpci 18-81
Item (env collection object) Purpose Retrieve specific xPC Target environment (env) object Syntax MATLAB command line env_collection_object.Item('env_object_name') Description Method of xpctarget.targets objects. Item retrieves a specific xPC Target environment object from the xpctarget.targets class. Use this method to work with a particular target PC environment object. Examples Retrieve a new xPC Target environment collection object from the system.
load Purpose Download target application to target PC Syntax MATLAB command line load(target_object,'target_application') target_object.load('target_application') Arguments Description target_object Name of an existing target object. target_application Simulink model and target application name. Before using this function, the target PC must be booted with the xPC Target kernel, and the target application must be built in the current working folder on the host PC.
loadparamset Purpose Restore parameter values saved in specified file Syntax MATLAB command line loadparamset(target_object,'filename') target_object.loadparamset('filename') Arguments Description target_object Name of an existing target object. filename Enter the name of the file that contains the saved parameters. loadparamset restores the target application parameter values saved in the file filename. This file must be located on a local drive of the target PC.
macaddr Purpose Convert string-based MAC address to vector-based one Syntax MATLAB command line macaddr('MAC address') Argument Description Example String-based MAC address to be converted. 'MAC address' The macaddr function converts a string-based MAC address to a vector-based MAC address. The string-based MAC address should be a string comprised of six colon-delimited fields of two-digit hexadecimal numbers.
makeDefault (env collection object) Purpose Set specific target PC environment object as default Syntax MATLAB command line env_collection_object.makeDefault(`env_object_name') Description Method of xpctarget.targets objects. makeDefault sets the specified target PC environment object as the default target PC from the xpctarget.targets class. Examples Set the specified target collection object as the default target PC collection. Assume that tgs represents the target object collection environment.
mkdir Purpose Make folder on target PC Syntax MATLAB command line mkdir(file_obj,dir_name) file_obj.mkdir(dir_name) Arguments Description file_obj Name of the xpctarget.ftp or xpctarget.fs object. dir_name Name of the folder to be created. Method of xpctarget.fsbase, xpctarget.ftp, and xpctarget.fs objects. From the host PC, makes a new folder in the current folder on the target PC file system.
put Purpose Copy file from host PC to target PC Syntax MATLAB command line put(file_obj,file_name) file_obj.put(file_name) Arguments Description file_obj Name of the xpctarget.ftp object. file_name Name of the file to copy to the target PC. Method of xpctarget.ftp objects. Copies a file from the host PC to the target PC. file_name must be a file in the current folder of the host PC. The method writes file_name to the target PC disk. put might be slower than the get operation for the same file.
pwd Purpose Current folder path of target PC Syntax MATLAB command line pwd(file_obj) file_obj.pwd Arguments file_obj Name of the xpctarget.ftp or xpctarget.fs object. Description Method of xpctarget.fsbase, xpctarget.ftp, and xpctarget.fs objects. Returns the pathname of the current target PC folder. Examples Return the target PC current folder for the file system object fsys. pwd(fsys) or fsys.pwd Return the target PC current folder for the FTP object f. pwd(f) or f.
readxpcfile Purpose Syntax Arguments Description Interpret raw data from xPC Target file format file=readxpcfile(data) readxpcfile('filename') data Vector of uint8 bytes. 'filename' File from which the vector of uint8 bytes is read. Vector is written The readxpcfile function converts xPC Target file format content (in bytes) to double precision data. A scope of type file creates the data.
readxpcfile xpcftp=xpctarget.ftp xpcftp.get('filename') datafile = readxpcfile('filename') % Convert the data Use the xpctarget.ftp object to copy the file from the target PC to the host PC, then read and convert the data separately. xpcftp=xpctarget.ftp xpcftp.
reboot Purpose Reboot target PC Syntax MATLAB command line reboot(target_object) Target PC command line reboot Arguments Description target_object Name of an existing target object. reboot reboots the target PC, and if a target boot disk is still present, the xPC Target kernel is reloaded. You can also use this method to reboot the target PC back to Windows after removing the target boot disk. Note This method might not work on some target hardware.
Remove (env collection object) Purpose Remove specific xPC Target environment object Syntax MATLAB command line env_collection_object.Remove('env_collection_object_name') Description Method of xpctarget.targets objects. Remove removes an existing xPC Target environment object from the environment collection. Note that if you remove the target environment object of the default target PC, the next target environment object becomes the default target PC.
removefile Purpose Remove file from target PC Syntax MATLAB command line removefile(file_obj,file_name) file_obj.removefile(file_name) Arguments Description file_name Name of the file to remove from the target PC file system. file_obj Name of the xpctarget.fs object. Method of xpctarget.fs objects. Removes a file from the target PC file system. Note You cannot recover this file once it is removed. Examples Remove the file data2.dat from the target PC file system fsys. removefile(fsys,'data2.
remscope Purpose Remove scope from target PC Syntax MATLAB command line remscope(target_object, scope_number_vector) target_object.remscope(scope_number_vector) remscope(target_object) target_object.remscope Target PC command line remscope scope_number remscope 'all' Arguments target_object Name of a target object. The default name is tg. scope_number_vector Vector of existing scope indices listed in the target object property Scopes. scope_number Description Single scope index.
remscope Note that you can only permanently remove scopes that are added with the method addscope. This is a scope that is outside a model. If you remove a scope that has been added through a scope block (the scope block is inside the model), a subsequent run of that model creates the scope again. Examples 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 scopes. remscope(tg) or tg.
remsignal Purpose Remove signals from scope represented by scope object Syntax MATLAB command line remsignal(scope_object) remsignal(scope_object, signal_index_vector) scope_object.remsignal(signal_index_vector) Target command line remsignal scope_index = signal_index, signal_index, . . . Arguments scope_object MATLAB object created with the target object method addscope or getscope. signal_index_vector Index numbers from the scope object property Signals.
remsignal Remove signals from the scope on the target PC with the scope object property Signals updated. remsignal(sc1,[0,1]) or sc1.remsignal([0,1]) See Also 18-98 The xPC Target scope object method remsignal and the target object method getsignalid.
rmdir Purpose Remove folder from target PC Syntax MATLAB command line rmdir(file_obj,dir_name) file_obj.rmdir(dir_name) Arguments Description dir_name Name of the folder to remove from the target PC file system. file_obj Name of the xpctarget.fs object. Method of xpctarget.fsbase, xpctarget.ftp, and xpctarget.fs objects. Removes a folder from the target PC file system. Note You cannot recover this folder once it is removed. Examples Remove the folder data2dir.
saveparamset Purpose Save current target application parameter values Syntax MATLAB command line saveparamset(target_object,'filename') target_object.saveparamset('filename') Arguments Description target_object Name of an existing target object. filename Enter the name of the file to contain the saved parameters. saveparamset saves the target application parameter values in the file filename. This method saves the file on a local drive of the target PC (C:\ by default).
selectdrive Purpose Select target PC drive Syntax MATLAB command line selectdrive(file_obj,'drive') file_obj.selectdrive('drive') Arguments Description drive Name of the drive to set. file_obj Name of the xpctarget.fs object. Method of xpctarget.fs objects. selectdrive sets the current drive of the target PC to the specified string. Enter the drive string with an extra backslash (\). For example, D:\\ for the D:\ drive. Note Use the cd method instead to get the same behavior.
set (env collection object) Purpose Change target object environment collection object property values Syntax MATLAB command line set(env_collection_object) set(env_collection_object, 'property_name1', 'property_value1','property_name2', 'property_value2', . . .) env_collection_object.set('property_name1', 'property_value1') set(env_collection_object, property_name_vector, property_value_vector) env_collection_object.
set (env collection object) Property Description Writable CCompiler Values are 'Watcom' and 'VisualC'. From the xPC Target Explorer window compiler list, select either Watcom or VisualC. Yes CompilerPath Value is a valid compiler root folder. Enter the path where you installed a Watcom C/C++ or Microsoft Visual Studio C/C++ compiler. Yes If the path is invalid or the folder does not contain the compiler, an error message appears when you use the function updatexpcenv or build a target application.
set (env collection object) set(tgs) ans = CCompiler: CompilerPath: DefaultTarget: NumTargets: {2x1 cell} {} {} {} Change the property CCompiler to Watcom. tgs.set('CCompiler','VisualC') or set(tgs, 'CCompiler','VisualC') As an alternative to the method set, use the target object property CCompiler. In the MATLAB window, type tgs.
set (env object) Purpose Change target environment object property values Syntax MATLAB command line set(env_object) set(env_object, 'property_name1', 'property_value1', 'property_name2', 'property_value2', . . .) env_object.set('property_name1', 'property_value1') set(env_object, property_name_vector, property_value_vector) env_object.property_name = property_value Arguments Description env_object Name of a target environment object. 'property_name' Name of a target environment object property.
set (env object) Environment Property Description Writable Name Target PC name. Yes HostTargetComm Values are 'RS232' and 'TcpIp'. Yes From the xPC Target Explorer window Host target communication list, select either RS232 or TCP/IP. If you select RS232, you also need to set the property RS232HostPort. If you select TCP/IP, then you also need to set all properties that start with TcpIp. TargetRAMSizeMB Values are 'Auto' and 'Manual'.
set (env object) Environment Property Description Writable Manual, and enter the amount of RAM installed in the target PC. MaxModelSize BootFloppy and DOSLoader modes ignore this value. Yes Values are '1MB', '4MB', and '16MB. From the xPC Target Explorer window Maximum model size list, select either 1 MB, 4 MB, or 16 MB. This value is unavailable for BootFloppy or DOSLoader modes. Choosing the maximum model size reserves the specified amount of memory on the target PC for the target application.
set (env object) Environment Property Description Writable TargetScope Values are 'Disabled' and 'Enabled'. Yes From the xPC Target Explorer window Enable target scope list, select either Enabled or Disabled. The property TargetScope is set by default to Enabled. If you set TargetScope to Disabled, the target PC displays information as text. To use all the features of the target scope, you also need to install a keyboard on the target PC.
set (env object) Environment Property Description Writable NetworkBoot. With the xPC Target Embedded Option product licensed and installed, you have the additional choice of Standalone. EmbeddedOption Values are 'Disabled' and 'Enabled'. This property is read only. Yes Note that the xPC Target Embedded Option product is enabled only if you purchase an additional license. SecondaryIDE Values are 'off' and 'on'.
set (env object) Environment Property Description Writable RS232Baudrate Values are '115200', '57600', '38400', '19200', '9600', '4800’, '2400', and '1200'. Yes From the Baud rate list, select 115200, 57600, 38400, 19200, 9600, 4800, 2400, or 1200. TcpIpTargetAddress Value is 'xxx.xxx.xxx.xxx'. Yes In the xPC Target Explorer window Target PC IP address box, enter a valid IP address for your target PC. Ask your system administrator for this value. For example, 192.168.0.10.
set (env object) Environment Property Description Writable TcpIpGateway Value is 'xxx.xxx.xxx.xxx'. Yes In the xPC Target Explorer window TcpIp gateway address box, enter the IP address for your gateway. This property is set by default to 255.255.255.255, which means that a gateway is not used to connect to the target PC.
set (env object) Environment Property Description Writable TcpIpTargetBusType Values are 'PCI' and 'ISA'. Yes From the xPC Target Explorer window TcpIp target bus type list, select either PCI or ISA. This property is set by default to PCI, and determines the bus type of your target PC. You do not need to define a bus type for your host PC, which can be the same or different from the bus type in your target PC.
set (env object) Environment Property Description Writable in your target PC, choose another I/O port base address and make the corresponding changes to your jumper settings. TargetMACAddress Physical target PC MAC address when booting within a dedicated network. Yes CCompiler Values are 'Watcom' and 'VisualC'. From the xPC Target Explorer window compiler list, select either Watcom or VisualC. Yes CompilerPath Value is a valid compiler root folder.
set (env object) Environment Property Description MathWorks recommends setting the IRQ to 5, 10, or 11. If one of these hardware settings leads to a conflict in your target PC, choose another IRQ and make the corresponding changes to your jumper settings.
set (scope object) Purpose Change property values for scope objects Syntax MATLAB command line set(scope_object_vector) set(scope_object_vector, property_name1, property_value1, property_name2, property_value2, . . .) scope_object_vector.set('property_name1', property_value1, ..) set(scope_object, 'property_name', property_value, . . .) Arguments scope_object Name of a scope object or a vector of scope objects. ’property_name’ Name of a scope object property. Always use quotation marks.
set (scope object) The properties for a scope object are listed in the following table. This table includes descriptions of the properties and the properties you can change directly by assigning a value. Property Description Writable Application Name of the Simulink model associated with this scope object. No AutoRestart Values are 'on' and 'off'.
set (scope object) Property Description Writable DynamicFileName Values are 'on' and 'off'. By default, the value is 'off'. Yes Enable the ability to dynamically create multiple log files for file scopes. To use DynamicFileName, set AutoRestart to 'on' first. When you enable DynamicFileName, configure Filename to create incrementally numbered file names for the multiple log files. Failure to do so causes an error when you try to start the scope.
set (scope object) Property Description file name, an underscore (_), and a < > specifier. Within the specifier, enter one to eight % symbols. Each symbol % represents a decimal location in the file name. The specifier can appear anywhere in the file name. For example, the following value for Filename, C:\work\file_<%%%>.dat creates file names with the following pattern: file_001.dat file_002.dat file_003.dat The last file name of this series will be file_999.dat.
set (scope object) Property Description Writable MaxWriteFileSize Provide the maximum size of Filename, in bytes. This value must be a multiple of WriteSize. Default is 536870912. Yes When the size of a log file reaches MaxWriteFileSize, the software creates a subsequently numbered file name, and continues logging data to that file, up until the highest log file number you have specified. If the software cannot create any additional log files, it overwrites the first log file.
set (scope object) Property Description Writable For scopes of type Host, this parameter has no effect. NumPrePostSamples For scopes of type 'Host' or 'Target', this parameter is the number of samples collected before or after a trigger event. The default value is 0. Entering a negative value collects samples before the trigger event. Entering a positive value collects samples after the trigger event. If you set TriggerMode to 'FreeRun', this property has no effect on data acquisition.
set (scope object) Property Description Writable Signals List of signal indices from the target object to display on the scope. Yes Status Indicate whether data is being acquired, the scope is waiting for a trigger, the scope has been stopped (interrupted), or acquisition is finished. Values are 'Acquiring', 'Ready for being Triggered', 'Interrupted', and 'Finished'. No Time Contains the time data for a single data package from a scope.
set (scope object) Property Description Writable As a special case, setting TriggerSample to -1 means that the current scope is triggered at the end of the acquisition cycle of the triggering scope. Thus, the first sample of the triggering scope is acquired one sample after the last sample of the triggering scope. TriggerScope If TriggerMode is 'Scope', identifies the scope to use for a trigger. A scope can be set to trigger when another scope is triggered.
set (scope object) Property Description Writable WriteSize Enter the block size, in bytes, of the data chunks. This parameter specifies that a memory buffer, of length number of samples (NumSamples), collect data in multiples of WriteSize. By default, this parameter is 512 bytes, which is the typical disk sector size. Using a block size that is the same as the disk sector size provides optimal performance.
set (scope object) NumPrePostSamples: Mode: YLimit: Grid: {} {5x1 cell} {} {} The property value for the scope object sc1 is changed to on: sc1.set('grid', 'on') or set(sc1, 'grid', 'on') See Also 18-124 The xPC Target scope object method get (scope object). The target object methods set (target application object) and get (target application object). The built-in MATLAB functions get and set.
set (target application object) Purpose Change target application object property values Syntax MATLAB command line set(target_object) set(target_object, 'property_name1', 'property_value1', 'property_name2', 'property_value2', . . .) target_object.set('property_name1', 'property_value1') set(target_object, property_name_vector, property_value_vector) target_object.
set (target application object) are listed in the following table. This table includes a description of the properties: Property Description CommunicationTimeOut Communication timeout Writable Yes between host and target PC, in seconds. LogMode Controls which data points are logged: Yes • Time-equidistant logging. Logs a data point at every time interval. Set value to 'Normal'. • Value-equidistant logging.
set (target application object) Property Description Writable ShowParameters Flag set to view or hide the list of parameters from your Simulink blocks. This list is shown when you display the properties for a target object. Values are 'on' and 'off'. Yes ShowSignals Flag set to view or hide the list of signals from your Simulink blocks. This list is shown when you display the properties for a target object. Values are 'on' and 'off'. Yes StopTime Time when the target application stops running.
set (target application object) The function set typically does not return a value. However, if called with an explicit return argument, for example, a = set(target_object, property_name, property_value), it returns the value of the properties after the indicated settings have been made. Examples Get a list of writable properties for a scope object. set(tg) ans = StopTime: SampleTime: ViewMode: LogMode: ShowParameters: ShowSignals: {} {} {} {} {} {} Change the property ShowSignals to on. tg.
setparam Purpose Change writable target object parameters Syntax MATLAB command line setparam(target_object, parameter_index, parameter_value) Arguments Description target_object Name of an existing target object. The default name is tg. parameter_index Index number of the parameter. parameter_value Value for a target object parameter. Method of a target object. Set the value of the target parameter.
setparam NewValues: {[10] 18-130 [100]}
setxpcenv Purpose Change xPC Target environment properties Syntax MATLAB command line setxpcenv('property_name', 'property_value') setxpcenv('prop_name1', 'prop_val1', 'prop_name2', 'prop_val2') setxpcenv Arguments property_name Not case sensitive. Property names can be shortened as long as they can be differentiated from the other property names. property_value Character string. Type setxpcenv without arguments to get a listing of allowed values. Property values are not case sensitive.
setxpcenv Environment Property Description CDBootImageLocation Location of cdboot.iso file for creation of CD target boot disk. CompilerPath Value is a valid compiler root folder. Enter the path where you installed a Watcom C/C++ or Microsoft Visual Studio C/C++ compiler. If the path is invalid or the folder does not contain the compiler, an error message appears when you use the function updatexpcenv or build a target application.
setxpcenv Environment Property Description MaxModelSize BootFloppy and DOSLoader modes ignore this value. Values are '1MB', '4MB', and '16MB'. From the xPC Target Explorer window Maximum model size list, select either 1 MB, 4 MB, or 16 MB. This value is unavailable for BootFloppy or DOSLoader modes. Choosing the maximum model size reserves the specified amount of memory on the target PC for the target application. The remaining memory is used by the kernel and by the heap for data logging.
setxpcenv Environment Property Description RS232HostPort Values are 'COM1' and 'COM2'. From the xPC Target Explorer window Host port list, select either COM1 or COM2 for the connection on the host computer. The xPC Target software automatically determines the COM port on the target PC. Before you can select an RS-232 port, you need to set the HostTargetComm property to RS232. SecondaryIDE Values are 'off' and 'on'.
setxpcenv Environment Property Description TargetRAMSizeMB Values are 'Auto' and 'Manual'. From the xPC Target Explorer window Target RAM size list, select either Auto or Manual. If you select Manual, enter the amount of RAM, in megabytes, installed on the target PC. This property is set by default to Auto. Target RAM size defines the total amount of installed RAM in the target PC. This RAM is used for the kernel, target application, data logging, and other functions that use the heap.
setxpcenv Environment Property Description TcpIpGateway Value is 'xxx.xxx.xxx.xxx'. In the xPC Target Explorer window TcpIp gateway address box, enter the IP address for your gateway. This property is set by default to 255.255.255.255, which means that a gateway is not used to connect to the target PC. If you communicate with your target PC from within a LAN that uses gateways, and your host and target computers are connected through a gateway, then you need to enter a value for this property.
setxpcenv Environment Property Description TcpIpTargetBusType Values are 'PCI' and 'ISA'. From the xPC Target Explorer window TcpIp target bus type list, select either PCI or ISA. This property is set by default to PCI, and determines the bus type of your target PC. You do not need to define a bus type for your host PC, which can be the same or different from the bus type in your target PC.
setxpcenv Environment Property Description TcpIpTargetISAIRQ Value is 'n', where n is between 4 and 15. If you are using an ISA bus Ethernet card, you must enter values for the properties TcpIpISAMemPort and TcpIpISAIRQ. The values of these properties must correspond to the jumper settings or ROM settings on the ISA-bus Ethernet card. On your ISA bus card, assign an IRQ and I/O-port base address by moving the jumpers on the card. MathWorks recommends setting the IRQ to 5, 10, or 11.
setxpcenv Using the function setxpcenv without arguments returns a list of allowed property values in the MATLAB window. Examples List the current environment properties. setxpcenv Change the serial communication port of the host PC to COM2. setxpcenv('RS232HostPort','COM2') See Also The xPC Target functions getxpcenv, updatexpcenv, and xpcbootdisk.
start (scope object) Purpose Start execution of scope on target PC Syntax MATLAB command line start(scope_object_vector) scope_object_vector.start +scope_object_vector start(getscope((target_object, signal_index_vector)) Target PC command line startscope scope_index startscope 'all' Arguments Description 18-140 target_object Name of a target object.
start (scope object) Examples Start one scope with the scope object sc1. sc1 = getscope(tg,1) or sc1 = tg.getscope(1) start(sc1) or sc1.start or +sc1 or type start(getscope(tg,1)) Start two scopes. somescopes = getscope(tg,[1,2]) or somescopes= tg.getscope([1,2]) start(somescopes) or somescopes.start or type sc1 = getscope(tg,1) or sc1 =tg.getscope(1) sc2 = getscope(tg,2) or sc2 = tg.
start (target application object) Purpose Start execution of target application on target PC Syntax MATLAB command line start(target_object) target_object.start +target_object Target PC command line start Arguments target_object Name of a target object. The default name is tg. Description Method of both target and scope objects. Starts execution of the target application represented by the target object. Before using this method, the target application must be created and loaded on the target PC.
stop (scope object) Purpose Stop execution of scope on target PC Syntax MATLAB command line stop(scope_object_vector) scope_object.stop -scope_object stop(getscope(target_object, signal_index_vector)) Target PC command line stopscope scope_index stopscope 'all' Arguments target_object Name of a target object.
stop (scope object) allscopes = getscope(tg) or allscopes = tg.getscope. stop(allscopes) or allscopes.stop or -allscopes or type stop(getscope(tg)) or stop(tg.getscope) See Also 18-144 The xPC Target target object methods getscope, stop (target application object), and start (target application object). The scope object method start (scope object).
stop (target application object) Purpose Stop execution of target application on target PC Syntax MATLAB command line stop(target_object) target_object.stop -target_object Target PC command line stop Arguments target_object Name of a target object. Description Stops execution of the target application represented by the target object. If the target application is stopped, this command has no effect. Examples Stop the target application represented by the target object tg. stop(tg) or tg.
targetping Purpose Test communication between host and target computers Syntax MATLAB command line targetping(target_object) target_object.targetping Arguments Description target_object Name of a target object. Method of a target object. Use this method to ping a target PC from the host PC. It returns either success or failed. If the xPC Target kernel is loaded, running, and communication is working properly, this function returns the value success.
trigger Purpose Software-trigger start of data acquisition for scope(s) Syntax MATLAB command line trigger(scope_object_vector) or scope_object_vector.trigger Arguments Description scope_object_vector Name of a single scope object, name of a vector of scope objects, list of scope object names in a vector form [scope_object1, scope_object2], or the target object method getscope, which returns a scope_object vector. Method for a scope object.
trigger allscopes.triggermode = 'software' allscopes.start or start(allscopes) or +allscopes allscopes.
unload Purpose Remove current target application from target PC Syntax MATLAB command line unload(target_object) target_object.unload Arguments Description target_object Name of a target object that represents a target application. Method of a target object. The kernel goes into loader mode and is ready to download new target application from the host PC. Note If you are running in StandAlone mode, this command has no effect.
updatexpcenv Purpose Change current environment properties to new properties Syntax MATLAB command line updatexpcenv Description Function to update environment properties. Call the function updatexpcenv in the following order: 1 Enter new properties with the function setxpcenv. 2 Type updatexpcenv to change the current properties to match the new properties. 3 Create a target boot floppy with the function xpcbootdisk. See Also 18-150 The xPC Target functions setxpcenv, getxpcenv, and xpcbootdisk.
xpc Purpose Call target object constructor, xpctarget.xpc See Also xpctarget.
xpcbootdisk Purpose Create xPC Target boot disk or DOS Loader files and confirm current environment properties Syntax MATLAB command line xpcbootdisk Description Function to create an xPC Target boot floppy, CD or DVD boot image, network boot image, or DOS Loader files for the current xPC Target environment that has been updated with the function updatexpcenv. Use the setxpcenv function to set environment properties.
xpcbootdisk Examples To create a boot floppy disk, in the MATLAB window, type: xpcbootdisk See Also The xPC Target functions setxpcenv, getxpcenv, and updatexpcenv. The procedures “Changing Environment Properties with xPC Target Explorer” on page 6-3 and “Changing Environment Properties with a Command-Line Interface for Default Target PCs” on page 6-7.
xpcbytes2file Purpose Syntax Generate file suitable for use by From File block xpcbytes2file(filename, var1, ...,varn) Arguments Description filename Name of the data file from which the From File block distributes data. var1,...varn Column of data to be output to the model. The xpcbytes2file function outputs one column of var1,..., varn at every time step. All variables must have the same number of columns; the number of rows and data types can differ.
xpcexplr Purpose Open xPC Target Explorer Syntax MATLAB command line xpcexplr Description This graphical user interface (GUI) allows you to • Manage an xPC Target system • Enter and change environment properties • Create an xPC Target boot disk • Build, download, and run target applications • Monitor signals • Tune parameters See Also The xPC Target functions setxpcenv, getxpcenv, updatexpcenv, and xpcbootdisk.
xpcnetboot Purpose Create kernel to boot target PC over dedicated network Syntax MATLAB command line xpcnetboot xpcnetboot targetPCname Arguments Description targetPCName Target PC name as identified in xPC Target Explorer. The xpcnetboot function creates an xPC Target kernel that a target PC within the same network can boot. This function also starts the following services as server processes: • Bootstrap protocol (bootp) — xpcbootpserver.
xpctarget.fs Purpose Create xPC Target file system object Syntax MATLAB command line filesys_object = xpctarget.fs('mode', 'arg1', 'arg2') Arguments filesys_object Variable name to reference the file system object. mode Optionally, enter the communication mode: arg1 arg2 Description TCPIP Specify TCP/IP connection with target PC. RS232 Specify RS-232 connection with target PC.
xpctarget.fs filesys_object=xpctarget.fs If you have multiple target PCs in your system, or if you want to identify a target PC with the file system object, use the following syntax to create the additional file system objects. filesys_object=xpctarget.fs('mode', 'arg1', 'arg2') Examples In the following example, a file system object for a target PC with an RS-232 connection is created. fs1=xpctarget.fs('RS232','COM1','115200') fs1 = xpctarget.fs Optionally, if you have an xpctarget.
xpctarget.ftp Purpose Create xPC Target FTP object Syntax MATLAB command line file_object = xpctarget.ftp('mode', 'arg1', 'arg2') Arguments file_objectVariable name to reference the FTP object. mode arg1 arg2 Description Optionally, enter the communication mode: TCPIP Specify TCP/IP connection with target PC. RS232 Specify RS-232 connection with target PC. Optionally, enter an argument based on the mode value: IP address If mode is 'TCPIP', enter the IP address of the target PC.
xpctarget.ftp If you have multiple target PCs in your system, or if you want to identify a target PC with the file object, use the following syntax to create the additional file objects. file_object=xpctarget.ftp('mode', 'arg1', 'arg2') Examples In the following example, a file object for a target PC with an RS-232 connection is created. f=xpctarget.ftp('RS232','COM1','115200') f = xpctarget.ftp Optionally, if you have an xpctarget.xpc object, you can construct an xpctarget.
xpctarget.targets Purpose Create container object to manage target PC environment collection objects Syntax MATLAB command line env_collection_object = xpctarget.targets Description Constructor target object collection environment container. The environment container manages the environment object (xpctarget.env) for a multitarget xPC Target system. (This is in contrast to the setxpcenv and getxpcenv functions, which manage the environment properties for the default target PC.
xpctarget.targets Property Summary Examples Method Description makeDefault (env collection object) Set target PC environment collection object as default. Remove (env collection object) Remove an xPC Target environment collection object. Property Description Writable CCompiler Values are 'Watcom' and 'VisualC'. Yes CompilerPath Value is a valid compiler root folder. Enter the path where you installed a Watcom C/C++ or Microsoft Visual Studio C/C++ compiler.
xpctarget.targets tgs = xpctarget.targetst = xpctarget.
xpctarget.xpc Purpose Create target object representing target application Syntax MATLAB command line target_object = xpctarget.xpc('mode', 'arg1', 'arg2') target_object=xpctarget.xpc('target_object_name') Arguments target_object Variable name to reference the target object mode Optionally, enter the communication mode arg1 arg2 TCPIP Enable TCP/IP connection with target PC. RS232 Enable RS-232 connection with target PC.
xpctarget.xpc Description Constructor of a target object. The target object represents the target application and target PC. You make changes to the target application by changing the target object using methods and properties. If you have one target PC, or if you designate a target PC as the default one in your system, use the syntax target_object=xpctarget.xpc If you have multiple target PCs in your system, use the following syntax to create the additional target objects. target_object=xpctarget.
xpctarget.xpc tg1=xpctarget.xpc('RS232','COM1','115200') xPC Object Connected Application = Yes = loader If you have an xPC Target Explorer target object, and you want to construct a corresponding target object in the MATLAB Command Window, use a command like the following: target_object=xpctarget.xpc('TargetPC1') See Also 18-166 xPC Target methods get (target application object), set (target application object), delete, and targetping.
xpctargetping Purpose Test communication between host and target PCs Syntax MATLAB command line xpctargetping xpctargetping('mode', 'arg1', 'arg2') Arguments mode arg1 arg2 Description Optionally, enter the communication mode: TCPIP Enable TCP/IP connection with target PC. RS232 Enable RS-232 connection with target PC. Optionally, enter an argument based on the mode value: IP address If mode is 'TCPIP', enter the IP address of the target PC.
xpctargetping If you have multiple target PCs in your system, use the following syntax to identify the target PC to ping. xpctargetping('mode', 'arg1', 'arg2') If the xPC Target kernel is loaded, running, and communication is working properly, this function returns the value success. This function works with both RS-232 and TCP/IP communication. ans = success Examples Check for communication between the host PC and target PC.
xpctargetspy Purpose Open Real-Time xPC Target Spy window on host PC Syntax MATLAB command line xpctargetspy xpctargetspy(target_object) xpctargetspy('target_object_name') Arguments target_object Variable name to reference the target object. target_object_name Target object name as specified in the xPC Target Explorer. Description This graphical user interface (GUI) allows you to upload displayed data from the target PC.
xpctargetspy The behavior of this function depends on the value for the environment property TargetScope: • If TargetScope is enabled, a single graphics screen is uploaded. The screen is not continually updated because of a higher data volume when a target graphics card is in VGA mode. You must explicitly request an update. To manually update the host screen with another target screen, move the pointer into the Real-Time xPC Target Spy window and right-click to select Update xPC Target Spy.
xpctest Purpose Test xPC Target installation Syntax MATLAB command line xpctest xpctest('target_name') xpctest('-noreboot') xpctest('noreboot') xpctest('target_name', 'noreboot') xpctest('target_name', '-noreboot') Arguments Description 'target_name' Name of target PC to test. 'noreboot' Only one possible option. Skips the reboot test. Use this option if the target hardware does not support software rebooting. Value is 'noreboot' or '-noreboot'.
xpctest xpctest('target_name') runs the tests on the target PC identified by 'target_name'. xpctest('target_name', 'reboot') or xpctest('target_name', '-reboot') runs the tests on the target PC identified by 'target_name', but skips the reboot test.
xpcwwwenable Purpose Disconnect target PC from current client application Syntax MATLAB command line xpcwwwenable xpcwwwenable('target_obj_name') Description Use this function to disconnect the target application from the MATLAB interface before you connect to the Web browser. You can also use this function to connect to the MATLAB interface after using a Web browser, or to switch to another Web browser.
xpcwwwenable 18-174
19 Configuration Parameters
19 Configuration Parameters xPC Target options Pane 19-2
xPC Target options Pane In this section...
19 Configuration Parameters xPC Target options Overview Set up general information about building target applications, including target, execution, data logging, and other options. Configuration To enable the xPC Target options pane, you must: 1 Select xpctarget.tlc or xpctargetert.tlc for the System target file parameter on the Real-Time Workshop pane. 2 Select C for the Language parameter on the Real-Time Workshop pane.
xPC Target options Pane Automatically download application after building Enable Real-Time Workshop to build and download the target application to the target PC. Settings Default: on On Builds and downloads the target application to the target PC. Off Builds the target application, but does not download it to the target PC.
19 Configuration Parameters Download to default target PC Direct Real-Time Workshop to download the target application to the default target PC. Settings Default: on On Downloads the target application to the default target PC. Your default target PC must be set up in xPC Target Explorer. Off Enables the Specify target PC name field so that you can enter the target PC to which to download the target application. Tip This assumes that you configured a default target PC through the xPC Target Explorer.
xPC Target options Pane Specify target PC name Specify a target PC name for your target application. Settings '' Tip The target PC name appears in the xPC Target Explorer as the target PC node, for example TargetPC1. Dependencies This parameter is enabled by Download to default target PC.
19 Configuration Parameters Name of xPC Target object created by build process Enter the name of the target object created by the build process. Settings Default: tg Tip Use this name when you work with the target object through the command-line interface.
xPC Target options Pane Use default communication timeout Direct xPC Target software to wait 5 (default) seconds for the target application to be downloaded to the target PC. Settings Default: on On Waits the default amount of seconds (5) for the target application to be downloaded to the target PC. Off Enables the Specify the communication timeout in seconds field so that you can enter the maximum length of time in seconds you want to wait for a target application to be downloaded to the target PC.
19 Configuration Parameters Specify the communication timeout in seconds Specify a timeout, in seconds, to wait for the target application to download to the target PC. Settings Default: 5 Tip Enter the maximum length of time in seconds you want to allow the xPC Target software to wait for the target application to download to the target PC. If the target application is not downloaded within this time frame, the software generates an error.
xPC Target options Pane Execution mode Specify target application execution mode. Settings Default: Real-Time Real-Time Executes target application in real time. Freerun Runs the target application as fast as possible.
19 Configuration Parameters Real-time interrupt source Select a real-time interrupt source from the I/O board. Settings Default: Timer Timer Specifies that the board interrupt source is a timer. Auto (PCI only) Enables the xPC Target software to automatically determine the IRQ that the BIOS assigned to the board and use it. 3 to 15 Specifies that the board interrupt source is an IRQ number on the board. Tips • The Auto (PCI only) option is available only for PCI boards.
xPC Target options Pane I/O board generating the interrupt Specify the board interrupt source. Settings Default: None/Other None/Other Specifies that the I/O board has no interrupt source. ATI-RP-R5 Specifies that the interrupt source is an ATI-RP-R5 board. AudioPMC+ Specifies that the interrupt source is the Bittware AudioPMC+ board. CB_CIO-CTR05 Specifies that the interrupt source is the Measurement Computing CIO-CTR05 board.
19 Configuration Parameters SBS_25x0_ID_0x101 Specifies that the interrupt source is an SBS Technologies shared memory board associated with ID 0x101. SBS_25x0_ID_0x102 Specifies that the interrupt source is an SBS Technologies shared memory board associated with ID 0x102. SBS_25x0_ID_0x103 Specifies that the interrupt source is an SBS Technologies shared memory board associated with ID 0x103. Scramnet_SC150+ Specifies that the interrupt source is the Systran Scramnet+ SC150 board.
xPC Target options Pane 'SBS_25x0_ID_0x100' | 'SBS_25x0_ID_0x101' | 'SBS_25x0_ID_0x102' | 'SBS_25x0_ID_0x103' | 'Scramnet_SC150+' | 'Softing_CAN-AC2-104' | 'Softing_CAN-AC2-PCI' | 'UEI_MFx' | 'GE_Fanuc(VMIC)_PCI-5565' Default: 'None/Other' See Also Entering the Real-Time Workshop Parameters 19-15
19 Configuration Parameters PCI slot (-1: autosearch) or ISA base address Enter the slot number or base address for the I/O board generating the interrupt. Settings Default: -1 The PCI slot can be either -1 (let the xPC Target software determine the slot number) or of the form [bus, slot]. The base address is a hexadecimal number of the form 0x300.
xPC Target options Pane Allow tasks to execute concurrently Enables multirate models to take advantage of target PCs that have multicore processors. Settings Default: off On Enables multirate models to take advantage of target PCs that have multicore processors. Off Disables multirate models to take advantage of target PCs that have multicore processors. Tips • Multirate models must use Rate Transition blocks. If your model uses other blocks for rate transitions, building the model generates an error.
19 Configuration Parameters Value: 'on' | 'off' Default: 'off' See Also xPC Target Options “Automatically handle rate transition for data transfer” 19-18
xPC Target options Pane Log Task Execution Time Log task execution times to the target object property tg.TETlog. Settings Default: on On Logs task execution times to the target object property tg.TETlog. Off Does not log task execution times to the target object property tg.TETlog.
19 Configuration Parameters Double buffer parameter changes Use a double buffer for parameter tuning. This enables parameter tuning so that the process of changing parameters in the target application uses a double buffer. Settings Default: off On Changes parameter tuning to use a double buffer. Off Suppresses double buffering of parameter changes in the target application. Tips • When a parameter change request is received, the new value is compared to the old one.
xPC Target options Pane Load a parameter set from a file on the designated target file system Load a parameter set from a file on the designated target PC file system. Settings Default: off On Enable the loading of a parameter set from a specific file on the designated target PC file system. Off Suppress the capability to load a parameter set from a specific file on the designated target PC file system. Dependencies This parameter enables File name.
19 Configuration Parameters File name Specify the target PC file name from which to load the parameter set. Settings '' Tip If the named file does not exist, the software loads the parameter set built with the model. Dependencies This parameter is enabled by Load a parameter set from a file on the designated target file system.
xPC Target options Pane Signal logging data buffer size in doubles Enter the maximum number of sample points to save before wrapping. Settings Default: 100000 The maximum value for this option can be no more than the available target PC memory, which the xPC Target software also uses to hold other items. Tips • Target applications use this buffer to store the time, states, outputs, and task execution time logs as defined in the Simulink model.
19 Configuration Parameters Default: '100000' See Also xPC Target Options 19-24
xPC Target options Pane Build COM objects from tagged signals/parameters Enable build process to create a model-specific COM library file. Settings Default: off On Creates a model-specific COM library file, COMiface.dll. Off Does not create a model-specific COM library file. Tip Use the model-specific COM library file to create custom GUIs with Visual Basic or other tools that can use COM objects.
19 Configuration Parameters Generate CANape extensions Enable target applications to generate data, such as that for A2L, for Vector CANape. Settings Default: off On Enables target applications to generate data, such as that for A2L, for Vector CANape. Off Does not enable target applications to generate data, such as that for A2L, for Vector CANape.
xPC Target options Pane Include model hierarchy on the target application Includes the Simulink model hierarchy as part of the target application. Settings Default: off On Includes the model hierarchy as part of the target application. Off Excludes the model hierarchy from the target application. Tips Including the model hierarchy in the target application: • Lets you connect to the target PC from xPC Target Explorer without being in the target application build directory.
19 Configuration Parameters Enable Stateflow Animation Enables visualization of Stateflow chart animation. Settings Default: off On Enables visualization of Stateflow chart animation. Off Disables visualization of Stateflow chart animation.
Index A Index application parameters saving and reloading 3-76 applications with DOSLoader mode 4-4 with Standalone mode 5-9 B block parameters parameter tuning with external mode 3-73 C changing environment properties CLI 6-7 xPC Target Explorer 6-3 changing parameters using target object properties 3-70 xPC Target commands 3-70 command-line interface aliasing 16-7 scope object 1-3 scope object methods 16-4 scope object property commands 16-6 target object methods 16-2 target object property commands 16
Index xPC Target Explorer 6-3 environment collection objects target PC 7-2 environment properties and Standalone mode 5-9 changing through CLI 6-7 changing through xPC Target Explorer 6-3 list 6-2 updating through CLI 6-7 updating through xPC Target Explorer 6-3 external mode parameter tuning 3-73 F file system objects methods 17-8 xpctarget.
Index with MATLAB 3-70 with Simulink external mode 3-73 parameters changing with commands 3-70 inlining 3-79 tuning with external mode 3-73 tuning with MATLAB 3-70 tuning with Web browser 3-76 polling mode introduction 12-1 setting up 12-7 properties changing environment 6-7 environment list 6-2 updating environment 6-7 R readxpcfile 9-12 referenced models monitoring signals 3-9 S saving and reloading application parameters with MATLAB 3-76 saving and reloading application sessions 3-38 scope objects com
Index signal properties 3-9 target PC command-line interface 8-1 copying files with xpctarget.ftp 9-8 disk information retrieval with xpctarget.fs 9-16 environment collection objects 7-2 file content retrieval with xpctarget.fs 9-11 file conversion with xpctarget.fs 9-12 file information retrieval with xpctarget.fs 9-15 file removal with xpctarget.fs 9-14 file retrieval with xpctarget.ftp 9-7 folder listings with xpctarget.ftp 9-7 list of open files with xpctarget.
Index using xPC Target setup window 6-2 W Web browser 3-55 connecting 11-2 parameter tuning 3-76 signal logging 3-64 X xPC Target frequently asked questions 15-1 troubleshooting 15-1 Web browser 11-1 xPC Target Explorer adding signals 3-24 configuring the host scope viewer 3-31 creating scopes 3-17 logging 3-57 monitoring signals 3-2 stopping scopes 3-28 tracing signals 3-16 tuning parameters 3-67 xPC Target scope blocks 3-49 xPC Target Setup window 6-2 xpctarget.