Set up your model to work with Vector CANape®. The following
procedure uses the
xpcosc model. It assumes that
you have already configured your model to generate Simulink® Real-Time™ code.
If you have not done so, see Set Configuration Parameters and Simulink Real-Time Options Configuration Parameters.
It also assumes that you have already created a Vector CANape project.
If you have not done so, see Creating a New Vector CANape Project.
In the MATLAB® Command Window, type
Open the Simulink Real-Time library. For example, in the MATLAB window, type
Navigate to the
Displays and Logging sublibrary
and double-click that library.
Drag the XCP Server block
This block enables an XCP server process to run in the real-time application.
In the model, double-click the XCP Server block. Check the following parameters:
Target Address — Target
IP address for target computer. The default value is
Typically, you will want to leave the default entry. Otherwise, enter
the TCP/IP address for the target computer.
Server Port — Port for communication between target computer 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.
If you want to use the event mode to acquire signal
data, set the priority of the
xcpserver block to
be the lowest priority. For example, enter a priority of 10000000.
For Simulink blocks, the higher the priority number, the lower
In the model Simulink window, click Simulation > Model Configuration Parameters.
The Configuration Parameters dialog box is displayed for the model.
In the left pane, click the Simulink Real-Time Options node.
The associated pane is displayed.
In the Miscellaneous options area, select the Generate CANape extensions check box.
This option enables real-time applications to generate data, such as that for A2L (ASAP2), for Vector CANape.
Build the model.
The Simulink Real-Time software builds the real-time application, including an A2L (ASAP2) data file for the real-time application.
On the target computer monitor, look for the following message. These messages indicate that you have built the real-time application without producing an error and can now connect to the target with Vector CANape.
XCP Server set up, waiting for connection
You can now create a new Vector CANape project (see Creating a New Vector CANape Project.
This procedure describes how to create a new Vector CANape project that can communicate with a real-time application. It assumes that you have set up, built, and downloaded your model (see Setting Up and Building the Model).
In a DOS window, create a new folder to hold your project. This can be the same folder as your Simulink Real-Time model files. For example, type
Start Vector CANape.
Select File > New project.
A new project wizard is displayed. Follow this dialog to create a new project.
After you create the new project, start it.
After the preliminary warning, the CANape window is displayed.
You can now configure the target computer and the loaded real-time application as a Vector CANape device (see Configuring the Model for Vector CANape).
This procedure describes how to configure the Vector CANape Device to work with your real-time application. It assumes the following:
You have created a new Vector CANape project to associate with a particular real-time application. If you have not yet done so, see Creating a New Vector CANape Project.
You have set up, built, and downloaded your model. If you have not yet done so, see Setting Up and Building the Model.
If you have not yet started your new Vector CANape project, start it now.
The Vector CANape window is displayed.
In the CANape window, click Device > Device configuration.
The device configuration window is displayed.
In the device configuration window, click New.
In Device Name, enter a name for the device to describe your real-time application. For example, type
Add the required comments.
From the driver-type menu list, select XCP.
Click Driver settings.
The XCP driver settings window is displayed.
In the Transport layer pane,
from the Interface menu list, select
In the Transport layer pane, click Configuration.
In the Host field, enter the IP address of your target computer.
This is the target computer to which you have downloaded the real-time application.
Set the port number to
If you have Vector CANape Version 184.108.40.206 and higher, and you want to use the Simulink Real-Time software to acquire event driven data:
In the Driver pane of the XCP driver settings window, click Extended driver settings.
Set the ODT_ENTRY_ADDRESS_OPT_DISABLED parameter
With this setting, events that are generated in the Simulink Real-Time environment will be based on the model base sample time. For example, a sample time of 0.001 seconds will appear as 100 milliseconds.
In the XCP driver settings window, verify the connection to the target computer by clicking Test connection. This command succeeds only if the target computer is running and connected to exactly one development computer.
The Device dialog is displayed.
Do not exit the dialog.
You can now configure the location of the real-time application A2L (ASAP2) file for the CANape database. See Configuring the Location of the A2L (ASAP2) File.
If you want to load a new real-time application, you must close Vector CANape, download a new real-time application through the MATLAB interface, then restart Vector CANape.
Use this procedure to configure the location of the real-time 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.
Clear Automatic detection of the database name.
At the Database name parameter, click Browse.
The Select database dialog box for device
Browse to the folder that contains the A2L (ASAP2) file for the real-time application.
This might be the folder in which you built the real-time application, or it might be the folder you specified while configuring the real-time application.
Select the A2L (ASAP2) file. Click Open.
A dialog requests confirmation of ASAP2 settings.
You have completed the configuration of Vector CANape for the Simulink Real-Time software environment.
You can now monitor and control your Simulink Real-Time system. The CANape database should be populated with a comprehensive list of real-time application signals and parameters that are available. See Event Mode Data Acquisition.
During real-time application changes, you might need to manually reload the A2L (ASAP2) that is generated by the Simulink Real-Time build process. You can do this from the CANape Database editor.
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.
You have created a Vector CANape project folder and know the name of that project folder.
To enable Vector CANape to load the A2L (ASAP2) file for
In a DOS window, change folder to the one that contains the A2L (ASAP2) file from the previous procedure. For example:
Look for and copy the A2L (ASAP2) file to your Vector CANape project folder. For example:
copy xpcosc.a2l C:\MyProject
Vector CANape automatically loads the real-time application A2L (ASAP2) file when it connects to the target computer.