0% found this document useful (0 votes)
2K views78 pages

Matlab Simulink DLL in CANape

Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.

Uploaded by

Marian Popa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views78 pages

Matlab Simulink DLL in CANape

Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.

Uploaded by

Marian Popa
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

Matlab/Simulink DLLs in CANape 6.

Vector Informatik GmbH Dipl.- Ing. Andreas Patzer Dipl.- Ing.(FH) Gernot Knig
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. V2.92 2007-08-08

Agenda

> Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 2

Version / Software Information

The Matlab/Simulink Target for CANape supports


u

Matlab/Simulink Version 7.0, 7.1, 7.2 (R2006a), 7.3 (R2006b), 7.4 (R2007a) Microsoft C++ Compiler 6.0, 7.1 (Visual Studio 2003) and 8.0 (Visual Studio 2005) Microsoft C++ Compiler 8.0 needs Matlab Simulink 7.2 (R2006a) at least

u u

The current CANape Realtime Target 6.2.0 or above is necessary. To use Simulink DLLs CANape Graph Version 5.0 or above is necessary (CANape 6.5 is recommended).

This documentation is based on Matlab/Simulink 7.4 (R2007a), CANape 6.5 and CANape Realtime Target 6.2.2

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 3

Agenda

Version / Software Information > Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 4

Installation of CANape Realtime Target

Install the CANape Real-Time Target (DLL) for the Matlab/Simulink Real Time Workshop. The CANape Real-Time Target is included in the CANape MATLAB Integration Package that comes with CANape. Please find further information in Readme.htm which will be displayed after the installation.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 5

Agenda

Version / Software Information Installation of CANape Realtime Target > Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 6

Configuration of Matlab

u u

Choose your preferred compiler in Matlab by using the command: >> mex setup Answer the question: Would you like mex to locate installed compilers [y]/n? with "yes" and make your decision

The Matlab search path (File -> Set Path) will be set automatically. If your model couldnt be created be sure that the following entries are on top of the list

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 7

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab > Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 8

Create a Simulink model


Step 1: new model Create a new model in Matlab Start the Library browser

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 9

Create a Simulink model


Step 2: Library Browser The Library Browser displays all available blocksets. For the CANape target there are additional I/O blocksets in "Vector CANape". Blocksets could be inserted into the model using drag&drop:

Each model should have one input block and one output block at least.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 10

Create a Simulink model


Step 3: Names for I/Os Define the symbolic names of the I/Os in the model via a double click (these names are used by CANape to connect to real measurements/ parameters or global variables)

u u

Insert your algorithm Of course, it is possible to insert multiple Input-/OutputBlocks In CANape 6.5, the mapping between the model and real signals in CANape can be done by naming conventions. If the same name of an IO in the model and in e.g. an A2L- or DBC-file is used, CANape can map them automatically.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 11

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model > Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 12

Create a Simulink DLL from a Simulink Model


Overview The next slides will show how a Simulink DLL is created using the Realtime Workshop with CANape Target. Then the integration of the Simulink DLL into CANape is shown. Simulink Model

Realtime Workshop with CANape Target

A2L

DLL

MAP

INI

EMF EMF EMF

INI: Model Description file EMF: Pictures of the model hierarchy


2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 13

Create a Simulink DLL from a Simulink Model


HowTo 1. 2. 3. 4. 5. 6. 7. 8. Open an existing model or create one (see chapter "create a simulink model"). Select the CNP target in the RealTime Workshop Select fixed step for the running mode of the DLL Select the end time Select and define inline parameters Build the DLL Integrate the DLL into the measurement list of CANape Define the time raster and the synchronization between the signals and the Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 14

Create a Simulink DLL from a Simulink Model


Select CANape Target

Select CANape (cnp.tlc) Target

Tools-> RealTime Workshop-> Options

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 15

Create a Simulink DLL from a Simulink Model


Define Output Directory

Define Output Directory

Select CNP code generation options

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 16

Create a Simulink DLL from a Simulink Model


Time synchronization between CANape and the model DLL In the Real Time Workshop a time raster can be defined for the model
u

Alternative 1:
u

The Simulink DLL has a time raster defined in the Real Time Workshop options. The DLL gets the actual time from CANape. The DLL itself calculates in the defined time raster. In CANape the time raster of the DLL is defined in the measurement list and is independent from the Real Time Workshop based raster

Alternative 2:
u

In both cases CANape and the Simulink DLL are working time synchronized together. To realize fast communication (time raster below 10ms) between CANape and the model DLL please set the following CANape option: Tools -> Options-> Driver -> Make sure that a CANcardXL is used in the system!
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 17

Create a Simulink DLL from a Simulink Model


Solver options Select inf inf means No stop time

Select FixedStep

Select the preferred algorithm

SingleTasking the DLL is running in one task

Define time rate of the model 0.1 means: The model is running in a 100ms raster.
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 18

Create a Simulink DLL from a Simulink Model


Inline parameters

Select Inline parameters for generating an ASAP2 file (*.A2L)

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 19

Create a Simulink DLL from a Simulink Model


Build model

Generate the Simulink DLL (Ctrl + B)

The generated files (DLL, A2L, map file and source files) are located under: <model name>_cnp_rtw

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 20

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model > Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 21

Defining Signals and Parameters

Measurement signals and parameters of Simulink blocks that should be accessible by CANape have to be defined as Simulink Data Objects in the MATLAB Workspace with: X = ASAP2.Parameter X = ASAP2.Signal or

The target will automatically generate an ASAP2 file for the model. Additional information needed in the ASAP2 file has to be added to the Simulink data objects: Matlab Version 7 x.Value = xxxx x.Min = xxx x.Max = xxx Matlab Version 6 x.Value = xxx x.PhysicalMin_ASAP2 = xxx x.PhysicalMax_ASAP2 = xxx

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 22

Defining Signals and Parameters


Defining Parameters

Signals and Parameters must have Storage Class Exported Global Important: Define a start value e. g. 1

Define range of values

StorageClass ExportedGlobal

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 23

Defining Signals and Parameters


Defining Signals

1.) Double Click on line 2.) Give the line a name

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 24

Defining Signals and Parameters


Defining Signals

If needed, define a unit for the signal

Define Min, Max

StorageClass ExportedGlobal

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 25

Defining Signals and Parameters


/begin MEASUREMENT /* Name */ /* Long identifier */ /* Data type */ Signal_1 "" FLOAT64_IEEE

Entry in the A2L File

/* Conversion method */ COMPU_METHOD_1 /* Resolution (Not used) */ /* Accuracy (Not used) */ /* Lower limit */ /* Upper limit */ ECU_ADDRESS 0 0

-100.0 100.0 0

/begin IF_DATA CANAPE_EXT 100 LINK_MAP "Signal_1" 0x0 0x0 0 0x0 0 0x0 0x0 /end IF_DATA /end MEASUREMENT
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 26

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters > Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 27

Integrate Simulink DLL into CANape

Open the measurement list

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 28

Integrate Simulink DLL into CANape


1.) Insert new Simulink model into the measurement list

2.) Select the DLL

3.) The IOs of the model are shown automatically

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 29

Integrate Simulink DLL into CANape


Select a device for the automatic link (=map by name).

Link manually the IOs that couldnt be linked automatically

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 30

Integrate Simulink DLL into CANape

In this case, the input of the model is mapped to a signal channel1 of the ECU XCPsim. This signal can be measured in different modes. The selection is done here.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 31

Integrate Simulink DLL into CANape


The output ports of the model are mapped to parameters testword0 and testword1 of the ECU XCPsim. The values can be calibrated in different modes. In XCPsim there is only one STIM (stimulation) mode. Its called FilterBypassSt. The selection is done here.

With this configuration, a bypassing is establihed.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 32

Integrate Simulink DLL into CANape


Time Synchronization between CANape and the Simulink DLL

By selecting the measurement mode of the input signals (in this case channel1), the model itself will be called by CANape in the same mode (on XCPsim 10ms event of the ECU). To measure a signal out of the model, an event in the model can be used. Its called <modelname> calculated. This event occurs, after the model is ready with the calculation cycle.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 33

Integrate Simulink DLL into CANape


Time Synchronization

ECU XCPsim

Cyclic on ECU event 10 ms channel1

Cyclic on ECU event 10 ms

CANape
testword0 testword1

Simulink DLL
asap2demo_test1

Download mode

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 34

Integrate Simulink DLL into CANape


1. Integrate the model as a device into CANape

2. Select A2L file of the model.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 35

Integrate Simulink DLL into CANape

CANape reads the A2L file and tries to go online with the device. If this does not work, stay offline and open Driver parameters

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 36

Integrate Simulink DLL into CANape

3. Select the model.DLL

1. Bus type must be USER_DEFINED Bus interface <Browse DLL>

2. Press Configuration and select

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 37

Integrate Simulink DLL into CANape


Be aware, that the addresses in the A2L file are all initialized with 0000. Make sure that you update your addresses before starting measurement and calibration of the model.

MAP Select the appropriate map file format

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 38

Integrate Simulink DLL into CANape

Now the DLL is integrated as a Device in CANape, with XCP over DLL port

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 39

Integrate Simulink DLL into CANape


With the integration of the Simulink DLL into the measurement list, the DLL is up and running. Optional: To visualize the Simulink DLL a special window is available. It doesnt have to be used.

Right mouse button, select Matlab/Simulink window

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 40

Integrate Simulink DLL into CANape

INI 1.) Select the Simulink model INI file 2.) Select the device, described with the model A2L A2L

This can be used to show the model in the old style


2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 41

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape > Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 42

Model Explorer

This description based on the functionality of the code generation with RealTime Workshop and the usage of the CANape Target. In the make process, there is a Matlab call: VSaveModel(<modelname>) to generate the model description file and the EMF files of the model. If you does not use the CANape Target or even not the RealTime Workshop for code generating, you can use the Model Explorer anyway in CANape. The next slide shows, how to use VSaveModel ()

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 43

Model Explorer
Generate Data Without CANape Target and Realtime Workshop Model is developed in Simulink Type in Matlab Command Window: VSaveModel (<Modelname>) (VSaveModel is a Matlab Script developed by Vector which is part of the Matlab Integration Package)

EMF-Files from the model and its subsystems and a description file (INI) are generated, e.g.:

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 44

Model Explorer
Example

The Model Explorer shows the Simulink model in nearly the same way like Simulink. To generate the description file and the EMF files, a Matlab / Simulink is necessary. For the usage of the Model Explorer in CANape, the user does not need an own Matlab / Simulink license.
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 45

Model Explorer
Navigation

Simple click into subsystem (mouse pointer is shown as a hand) brings you down into the subsystem
Slide: 46

Double Click into subsystem brings you up to the higher level hierarchy

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.

Model Explorer
Navigation

When a parameter in a block is defined as a A2L parameter, a tooltip occurs. By double click into the block, the parameter windows come up. Even the CANape measurements is running, you can open and close the parameter windows.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 47

Model Explorer
Navigation Right mouse click into Explorer: With extended tool tip, all Simulink parameters are shown

The standard tool tip, shoes the A2L-File parameters

Zoom in and out

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 48

Model Explorer
Navigation Right mouse click onto an object, offers the possibility to find the object in the model.

Drag the object and drop it into an already existing window or into CANape to open a new window.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 49

Model Explorer
Navigation

Insert search string

Type, name and path will be shown directly

Right mouse click onto the object let you jump directly to the right page and the object will flash 3 times to show the position

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 50

Model Explorer
To find the object in the model, select the object in the tree with a right mouse click and select Display in the graphic. The explorer will show the right hierarchy layer and the object will slowly flash 3 times. Just the other way round: Right mouse click on the object in the picture and the object is highlighted in the tree.

Flashing!

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 51

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer > Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 52

Use Case 1: Simulink DLL during Online Measurement

Right mouse button, select Insert measurement signal The DLL can be used in the online mode as mentioned before.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 53

Use Case 1: Simulink DLL during Online Measurement

Alternative 1:

The output is assigned to an adjustable parameter

By inserting the DLL as a signal, the time raster will be shown.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 54

Use Case 1: Simulink DLL during Online Measurement

Alternative 2:

The output is assigned to "function result"

By inserting the DLL as a signal, the result of the Simulink DLL is displayed

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 55

Use Case 1: Simulink DLL during Online Measurement


Signal measurement out of the Model Model will be called, every time, the input signals are available channel1 channel2 flag_subsystem1 Input CANape Output STIM: testword0 testword1 testword2 testwod3 Event: FilterBypassS Model

DAQ: channel1 channel2 flag_subsystem1 ECU Event: 10ms XCPsim

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 56

Use Case 1: Simulink DLL during Online Measurement


Representation in the Model Configuration

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 57

Use Case 1: Simulink DLL during Online Measurement


Representation in the Measurement list The model itself is called with the event of the input signals The internal signal is measured after the model is completely calculated The stimulated signal is measured with the stimulation event (only available with XCP)

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 58

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement > Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 59

Use Case 2: Simulink DLL as an Offline Analyzing Tool

Example: Two signals from the file Canape.MDF

Right mouse button into the window Select Insert virtual file channel or press Shift+F7

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 60

Use Case 2: Simulink DLL as an Offline Analyzing Tool

Select Matlab DLL

Select the DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 61

Use Case 2: Simulink DLL as an Offline Analyzing Tool

The disc symbol shows that the source of the signal is a file. Select the signals from the file and map them to the In-/ Outputs of the model or link them automatically Select a time raster. Normally the fastest time raster of one of the input signals fits best. Select time range of the calculation. You can either use an explicit time range.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 62

Use Cases2: Simulink DLL as an Offline Analyzing Tool Case

Now an additional signal is integrated. The signal is calculated through the Simulink DLL.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 63

Use Case 2: Simulink DLL as an Offline Analyzing Tool


1.) right mouse button -> Save signals

2.) Select time range and store signals in new file

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 64

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool > Use Case 3: Bypassing with XCP Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 65

Use Case 3: Bypassing with XCP

Bypassing can be realized by making use of Synchronous Data Acquisition and Synchronous Data Stimulation simultaneously.

1.

2.

1. Synchronous Data AcQuisition (DAQ) 2. Synchronous Data Stimulation (STIM)

ECU

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 66

Use Case 3: Bypassing with XCP


Communication flow for a bypassing use case PC

ECU.A2L Model.A2L
6.

2. 3.

Simulink DLL

5.

1.

4.

ECU

Signal path 1. Receiving signals from the ECU (DAQ) 2. Sending the signals as an input into the DLL 3. Sending the results back to CANape 4. Sending the results back to the ECU (STIM) Calibration path 5. Calibration of the ECU (XCP) 6. Calibration of the DLL like an ECU with XCP

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 67

XCP

Use Case 3: Bypassing with XCP


Definition of the Stimulation Event for: 4. Sending the results back to the ECU (STIM)

This event channel cannot be used for bypassing therefore: Use events channels with STIM capability only!
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 68

Use Case 3: Bypassing with XCP

Model I/O-name Sum_in1 Sum_in2 Sum_out

ECU-I/O-name channel1 channel2 limit

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 69

Use Case 3: Bypassing with XCP

ECU XCPsim

Cyclic on ECU event 10 ms channel1 channel2

Cyclic on ECU event 10 ms

Simulink DLL m_sum

limit

The stimulate mode is available in version 5.6 and above.

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 70

Use Case 3: Bypassing with XCP

Data from CANape to the ECU

Data from ECU to CANape

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 71

Use Case 3: Bypassing with XCP

Using bypassing, the normal standard PC is the platform for the running model. In the example, the measurement was running 6 h!
PC ECU.A2L Model.A2L
6.

2. 3.

Simulink DLL

5.

1.

XCP

t =
Time Delay 450000 400000 350000 300000 250000

n1

tn1 tn2 tn2

4.

ECU

Latency range: 0,4 1,6ms

Bypassing time measured in the ECU!


Time Delay

200000 150000 100000 50000 0


1, 02 4 1, 22 88 1, 84 32 3, 07 2 3, 27 68 2, 45 76 1, 43 36 2, 86 72 0, 81 92 0, 40 96 s 0, 20 48 0, 61 44 1, 63 84 2, 04 8 2, 25 28 2, 66 24 /m
Slide: 72

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.

Ti m

Use Case 3: Bypassing with XCP

on RS 232 RS 232 DLL

on ##

slave
E T H Ethernet U S B C A N L I N F L X

USB CAN on Ethernet on Ethernet on Ethernet

FlexRay

LIN

ETH SxI
on SxI

ETH
DPRAM

on USB

on CAN

on LIN

on FlexRay

slave

slave

slave

slave

slave

slave

slave

slave

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 73

Agenda

Version / Software Information Installation of CANape Realtime Target Configuration of Matlab Create a Simulink model Create a Simulink DLL from a Simulink Model Defining Signals and Parameters Integrate Simulink DLL into CANape Model Explorer Use Case 1: Simulink DLL during Online Measurement Use Case 2: Simulink DLL as an Offline Analyzing Tool Use Case 3: Bypassing with XCP > Use Case 4: Generate CAN Messages with Simulink DLL

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 74

Use Case 4: Generate CAN Messages with Simulink DLL

u u u

Integrate a new Device Select CAN as the driver type Select a matching DBC file as the database

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 75

Use Case 4: Generate CAN Messages with Simulink DLL

Map the output value of the DLL to the signal in the DBC

Start measurement in CANape. By changing the value of the selected signal Kanal1, CANape will generate a new message and send it to the bus.
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 76

Use Case 4: Generate CAN Messages with Simulink DLL

This message was generated by CANape, cause the DLL changed the value of the signal Kanal1

2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 77

Thank you for your attention. For detailed information about Vector and our products please have a look at: www.vector-informatik.com Author: [email protected] [email protected] Vector Informatik GmbH Ingersheimerstr. 24 70499 Stuttgart
MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, Embedded MATLAB, and PolySpace are trademarks of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders.
2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. Slide: 78

You might also like