Matlab Simulink DLL in CANapeu - [PDF document] (2023)

Matlab Simulink DLL in CANapeu - [PDF document] (1)

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Version 2.92 08/08/2007

Matlab/Simulink DLLs in CANape 6.5

VectorInformatik GmbH

graduate engineer Andreas Patzer

Dipl.-Ing.(FH) Gernot König

Matlab Simulink DLL in CANapeu - [PDF document] (2)

2

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/Software Information>

Matlab Simulink DLL in CANapeu - [PDF document] (3)

3

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Version/software information

❑ Matlab/Simulink Target for CANape support

❑ Matlab/Simulink versions 7.0, 7.1, 7.2 (R2006a), 7.3 (R2006b), 7.4 (R2007a)

❑ Microsoft C++ Compiler 6.0, 7.1 (Visual Studio 2003) i 8.0 (Visual Studio 2005)

❑ Microsoft C++ 8.0 compiler in Matlab Simulink 7.2 (R2006a)

❑ Current version of CANape Realtime Target 6.2.0 or later is required.

❑ To use Simulink DLLs, CANape Graph 5.0 or higher is required (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

Matlab Simulink DLL in CANapeu - [PDF document] (4)

4

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Install CANape Realtime Target>

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (5)

5

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Installing CANape Realtime Target

❑ Install CANape Real-Time Target (DLL) for Matlab/Simulink Real Time Workshop.

❑ CANape Real-Time Target is included in the CANape MATLAB integration package provided with CANape.

❑ For more information displayed after installation, see the Readme.htm file.

Matlab Simulink DLL in CANapeu - [PDF document] (6)

6

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab > configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (7)

7

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Matlab configuration

❑ Select the required Matlab compiler with the command: >> mex –setup

❑ Answer the question: Do you want mex to locate the installed translators [y] /n? for yes and make a decision

❑ Matlab search path (File -> Set path…) is set automatically. If the model cannot be built, make sure the following entries are at the top of the list

Matlab Simulink DLL in CANapeu - [PDF document] (8)

8

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create Simulink>model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (9)

9

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink model

❑ Create a new model in Matlab. ❑ Start the library browser

Step 1: new model

Matlab Simulink DLL in CANapeu - [PDF document] (10)

10

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink model

❑ The Library Browser displays all available sets of blocks. There are additional I/O blocks in "Vector CANape" for the target CANape.

❑ Block blocks can be dragged and dropped into the model:

❑ Each model must have at least one input block and one output block.

Step 2: Library Browser

Matlab Simulink DLL in CANapeu - [PDF document] (11)

11

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink model

❑ Define symbolic names for inputs/outputs in the model by double-clicking (these names are used by CANape to link to real measurements/parameters or global variables)

❑ Enter your algorithm

❑ Of course, it is possible to insert more I/O blocks

Step 3: I/O names

In CANape 6.5, the mapping between model and real signals in CANape can be done through naming conventions. If the same IO name exists in the model and is used in an A2L or DBC file, for example, CANape can automatically map it.

Matlab Simulink DLL in CANapeu - [PDF document] (12)

12

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create Simulink DLL from Simulink>model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (13)

13

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink DLL from Simulink ModelOverview

Model Simulink

Real-time workshops

Gol CANape'a

DLL

❑ The following slides show how to create a Simulink DLL using Realtime Workshop with CANape Target.

❑ Then Simulink DLL integration with CANape was shown.

Karta A2L

TO EMFEMFEMF

INI: model description file

EMF: model hierarchy images

Matlab Simulink DLL in CANapeu - [PDF document] (14)

14

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink DLL based on the Simulink model

1. Open an existing model or create one (see "Creating a Simulink Model" chapter).

2. Select the CNP target in the RealTime Workshop

3. Select a fixed step for DLL mode

4. Select an end time

5. Select and define built-in parameters

6. Update the DLL

7. Integrate the DLL with the CANape measurement list

8. Define the timeframe and synchronization between the signal and the Simulink DLL

How

Matlab Simulink DLL in CANapeu - [PDF document] (15)

15

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink DLL based on the Simulink model

Tools->Real Time Workshop->Options

Odaberite CANape (cnp.tlc)Doel

Select a CANape target

Matlab Simulink DLL in CANapeu - [PDF document] (16)

16

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink DLL based on the Simulink model

Define the output folder

Select options for generating CNP codes

Define the output folder

Matlab Simulink DLL in CANapeu - [PDF document] (17)

17

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create Simulink DLL from Simulink ModelTime synchronization between CANape and model DLL

You can define a time grid for a model in a real-time workshop

❑ Alternative 1:

❑ The Simulink DLL has a time grid defined in the Realtime Workshop options. The DLL gets the real time from CANape. The DLL itself performs the calculations over a specified period of time.

❑ Alternative 2:

❑ In CANape, the DLL's time grid is defined in the measurement list and is independent of the real-time workshop based grid

In both cases, CANape and Simulink DLLs work together synchronously.

To achieve fast communication (less than 10ms time interval) between CANape and the model DLL, set the following CANape option:

Tools -> Options -> Driver ->

Make sure the system uses CANcardXL!

Matlab Simulink DLL in CANapeu - [PDF document] (18)

18

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink DLL based on the Simulink model

Select "Stand Stitch"

Select "inf" inf means "No stop time"

Select the desired algorithm

Define model speed. 0.1 means: The model runs in a 100ms grid.

The "SingleTasking" DLL is executed in a single task

Solving options

Matlab Simulink DLL in CANapeu - [PDF document] (19)

19

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink DLL based on the Simulink model

Select "Built-in parameters" to generate an ASAP2 file (*.A2L).

Built-in parameters

Matlab Simulink DLL in CANapeu - [PDF document] (20)

20

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Create a Simulink DLL based on the Simulink ModelBuild model

Generate Simulink DLL (Ctrl+B)

Generated files (DLL, A2L, map files and source files) are located at:_cnp_rtw

Matlab Simulink DLL in CANapeu - [PDF document] (21)

21

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Define signals and parameters>

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (22)

22

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

❑ The measurement signals and parameters of the Simulink blocks that CANape needs to access must be defined as Simulink Data Objects in MATLAB Workspace using:

X = ASAP2.Parametr X = ASAP2.Signal

The target automatically generates an ASAP2 file for the model. Additional information required in the ASAP2 file must be added to the Simulink data objects:

Matlab version 7x. Value = xxxx. min = xxx. max =xxx

Wersja Matlaba 6x.Value = xxxx.PhysicalMin_ASAP2 = xxxx.PhysicalMax_ASAP2 = xxx

Defining signals and parameters

Matlab Simulink DLL in CANapeu - [PDF document] (23)

23

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Defining signals and parameters

"ExportedGlobal" storage class

❑ Signals and parameters must be of "Exported Global" storage class.

Define a range of values

Important: Define a starting value, for example "1"

Define parameters

Matlab Simulink DLL in CANapeu - [PDF document] (24)

24

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Defining signals and parameters

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

Define the signal

Matlab Simulink DLL in CANapeu - [PDF document] (25)

25

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Defining signals and parameters

Define min., max

Specify the signal unit if necessary

"ExportedGlobal" storage class

Define the signal

Matlab Simulink DLL in CANapeu - [PDF document] (26)

26

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Defining signals and parameters

/start SURVEY

/* Name */ Signal_1

/* Long identifier */ ""

/* Data type */ FLOAT64_IEEE

/* Conversion method */ COMPU_METHOD_1

/* Resolution (not used) */ 0

/* Precision (not used) */ 0

/* Lower limit */ -100.0

/* Upper limit */ 100.0

ECU_ADDRESS 0

/start IF_DATA CANAPE_EXT

100

LINK_MAP "Signal_1" 0x0 0x0 0 0x0 0 0x0 0x0

/end IF_DATA

/end MEAS

Registration in the A2L file

Matlab Simulink DLL in CANapeu - [PDF document] (27)

27

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate Simulink DLL with CANape>

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (28)

28

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

Open the measurement list

Matlab Simulink DLL in CANapeu - [PDF document] (29)

29

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

1.) Add a new Simulink model to the measurement list

2.) Select the DLL

3.) IO models will be displayed automatically

Matlab Simulink DLL in CANapeu - [PDF document] (30)

30

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

Select device to connect automatically (=assign by name).

Manually connect inputs/outputs that cannot be connected automatically

Matlab Simulink DLL in CANapeu - [PDF document] (31)

31

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

In this case, the model input is mapped to the "channel 1" signal from the "XCPsim" ECU. This signal can be measured in various ways. This is where the choice is made.

Matlab Simulink DLL in CANapeu - [PDF document] (32)

32

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

The model output ports are assigned to the "test word 0" and "test word 1" parameters of the ECU XCPsim. The values ​​can be calibrated in various ways. There is only one STIM mode (stimulation) in XCPsim. It's called "FilterBypassSt". This is where the choice is made.

This configuration creates a workaround.

Matlab Simulink DLL in CANapeu - [PDF document] (33)

33

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate Simulink DLL with CANapeTime synchronization between CANape and Simulink DLL

By selecting the input signal measurement mode (in this case "channel 1"), CANape will call the model itself in the same mode (ECU event "on XCPsim 10ms").

An event in the model can be used to measure signals outside the model. It's called "calculated". This event occurs when the model is ready for a computational cycle.

Matlab Simulink DLL in CANapeu - [PDF document] (34)

34

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

ECU

XCPsimCANape

Simulink-DLL

as soon as possible2demo_test1

Cyclically on the ECU event "10ms" channel 1

control0testword1

Cyclic event in ECU "10ms"

Time synchronization

Download method

Matlab Simulink DLL in CANapeu - [PDF document] (35)

35

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

1. Integrate the model with CANape as a device

2. Select the A2L model file.

Matlab Simulink DLL in CANapeu - [PDF document] (36)

36

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

CANape reads the A2L file and tries to connect the device to the network. If that doesn't work, stay offline and open "Driver Settings"

Matlab Simulink DLL in CANapeu - [PDF document] (37)

37

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

1. The bus type must be "USER_DEFINED"

bus interface ''

2. Press Setup and select

3. Odaberite-model.DLL

Matlab Simulink DLL in CANapeu - [PDF document] (38)

38

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

Please note that all addresses in the A2L file are initialized to 0000. Remember to update the addresses before starting to measure and calibrate the model.

Select the correct map file format

CAPABLE OF

Matlab Simulink DLL in CANapeu - [PDF document] (39)

39

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

Now the DLL is integrated into CANape as a device, with XCP on the DLL port

Matlab Simulink DLL in CANapeu - [PDF document] (40)

40

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

Right click and select "Matlab/Simulink window"

By integrating the Simulink DLL with the measurement list, the DLL will work.

Optional: a separate window is available for visualizing the Simulink DLL. You don't need to use it.

Matlab Simulink DLL in CANapeu - [PDF document] (41)

41

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Integrate the Simulink DLL with CANape

1.) Select the Simulink model INI file

2.) Select the device described by model A2L

This allows the model to be displayed in the "old" style

A2L

TEN

Matlab Simulink DLL in CANapeu - [PDF document] (42)

42

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

the model is wrong>

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (43)

43

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model researcher

❑ This description is based on RealTime Workshop's code generation functionality and use of the CANape target.

❑ During the creation process, Matlab is called: VSaveModel('') to generate model description files and model EMF files.

❑ If you are not using CANape Target or even RealTimeWorkshop for code generation, you can still use Model Explorer in CANape.

❑ The next slide shows how to use the VSaveModel() function.

Matlab Simulink DLL in CANapeu - [PDF document] (44)

44

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model researcher

The model was developed in Simulink

In the Matlab command window, type:

� VSaveModel('')

(VSaveModel is a Matlab script developed by Vector and part of the Matlab integration suite)

❑ EMF files of the model and its subsystems and description (INI) files are generated, for example:

Generate data without purpose and workshop CANape in real time

Matlab Simulink DLL in CANapeu - [PDF document] (45)

45

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model ExplorerExample

The Model Explorer displays the Simulink model in a similar way to Simulink. Matlab/Simulink is required to generate description files and EMF files.

To use Model Explorer in CANape, the user does not need their own Matlab/Simulink license.

Matlab Simulink DLL in CANapeu - [PDF document] (46)

46

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model ExplorerNavigation

A simple click on a subsystem (the mouse pointer appears as a hand) takes you to the subsystem

Double-clicking an instance takes you to a higher level in the hierarchy

Matlab Simulink DLL in CANapeu - [PDF document] (47)

47

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model ExplorerNavigation

When a parameter in a block is defined as an A2L parameter, a hint appears.

Double-clicking on a block opens a window with parameters.

Even when CANape measurements are in progress, you can open and close parameter windows.

Matlab Simulink DLL in CANapeu - [PDF document] (48)

48

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model researcher

With extended tool tip, all Simulink

parameter su is displayed

The default hint sets the parameters of the A2L file

navigation

Right click in File Explorer:

Zoom in and out

Matlab Simulink DLL in CANapeu - [PDF document] (49)

49

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model researcher

By right-clicking an object, you can find the object in the model.

Drag the object to an existing window or to CANape to open a new window.

navigation

Matlab Simulink DLL in CANapeu - [PDF document] (50)

50

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model ExplorerNavigation

Enter a search string

The type, name and path are displayed immediately

By right-clicking on an object, you can go directly to the correct page. The subject will flash 3 times to indicate its position

Matlab Simulink DLL in CANapeu - [PDF document] (51)

51

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Model researcher

To find an object in the model, right-click on the object in the tree and select "Display in Image".

� The explorer displays the right hierarchy layer and the object flashes slowly 3 times.

� Conversely, right-click an object in the image and the object will be highlighted in the tree.

Flashing!

Matlab Simulink DLL in CANapeu - [PDF document] (52)

52

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL when measuring online>

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (53)

53

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Right-click on the "Insert measurement signal" option.

As mentioned earlier, the DLL can be used in network mode.

Use case 1: Simulink DLL during online measurements

Matlab Simulink DLL in CANapeu - [PDF document] (54)

54

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 1: Simulink DLL during online measurements

Alternative 1:

❑ The output is assigned to the adjustable parameter

❑ If you insert a DLL as a signal, the time grid will be displayed.

Matlab Simulink DLL in CANapeu - [PDF document] (55)

55

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 1: Simulink DLL during online measurements

Alternative 2:

❑ The output is assigned to the "function result"

❑ If you insert a DLL as a signal, the result of the Simulink DLL will be displayed

Matlab Simulink DLL in CANapeu - [PDF document] (56)

56

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 1: Simulink DLL when measuring the measurement signal online outside the model

Model

Bank

ECU

„XCPsim”

DAQ:channel1channel2

flag_subsystem1

Event: "10ms"

channel1channel2flag_subsystem1

The model is invoked as soon as inputs are available

Import

Exit

STIM:testword0testword1testword2testwod3

Event: "FilterBypassS"

Matlab Simulink DLL in CANapeu - [PDF document] (57)

57

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 1: Simulink DLL when displaying online measurements in model setup

Matlab Simulink DLL in CANapeu - [PDF document] (58)

58

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 1: Simulink DLL when displaying online measurements in the list of measurements

The model itself is called with event inputs

The internal signal is measured after the model is fully calculated

The stimulus signal is measured with the stimulus event (only available in XCP)

Matlab Simulink DLL in CANapeu - [PDF document] (59)

59

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool>

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (60)

60

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Example: Two signals from the file "Canape.MDF"

Right-click in the window

Select "Insert Virtual File Channel..." or press Shift+F7

Use case 2: Simulink DLL as an offline analysis tool

Matlab Simulink DLL in CANapeu - [PDF document] (61)

61

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Odaberite „Matlab DLL”

Select a DLL

Use case 2: Simulink DLL as an offline analysis tool

Matlab Simulink DLL in CANapeu - [PDF document] (62)

62

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Select signals from the file and connect them to the input/output of the model or connect them automatically

The disk symbol indicates that the signal source is a file.

Select a time grid. Usually the fastest time grid of one of the input signals works best.

Select the calculation time range. You can use an explicit time range.

Use case 2: Simulink DLL as an offline analysis tool

Matlab Simulink DLL in CANapeu - [PDF document] (63)

63

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

An additional signal has now been integrated. The signal is computed using the Simulink DLL.

Use cases Use case 2: Simulink DLL as an offline analysis tool

Matlab Simulink DLL in CANapeu - [PDF document] (64)

64

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

1.) right click -> "Save Signals"

2.) Select a time range and save the signals to a new file

Use case 2: Simulink DLL as an offline analysis tool

Matlab Simulink DLL in CANapeu - [PDF document] (65)

65

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use case 4: Generate CAN messages using the Simulink DLL

Use Case 3: Solution with XCP>

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (66)

66

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 3: Solution with XCP

A workaround can be achieved with synchronous data acquisition and synchronous data stimulation.

ECU

1.2.1. Synchronous data acquisition (DAQ)2. Synchronous Data Stimulation (STIM)

Matlab Simulink DLL in CANapeu - [PDF document] (67)

67

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

A2L driver

Use case 3: Solution with XCP

1.

Simulink-DLL2.

3.

4.

computer

Signal path 1. Receive signal from ECU (DAQ)2. Send a signal as input to DLL3. Send the results back to CANape4. Send results back to ECU Calibration Pad (STIM) 5. ECU Calibration (XCP)6. DLL calibration like ECU with XCP

Model.A2L6.

5.

ECU

XCP

Communication flow for the workaround use case

Matlab Simulink DLL in CANapeu - [PDF document] (68)

68

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 3: Solution with XCP

Definition of a stimulating event for:4. Return results to ECU (STIM)

Only use event channels with STIM features!

This event channel cannot be used for bridging

In connection with:

Matlab Simulink DLL in CANapeu - [PDF document] (69)

69

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 3: Solution with XCP

Model I/O Name ECU I/O Name Sum_in1 channel1 Sum_in2 channel2 Sum_out limit

Matlab Simulink DLL in CANapeu - [PDF document] (70)

70

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 3: Solution with XCP

ECU

XCPsim

SimulinkDLL

"I am"

Cyclic event in ECU "10ms" channel1channel2

limit

Cyclic event in ECU "10ms"

The "stim" mode is available in version 5.6 and higher.

Matlab Simulink DLL in CANapeu - [PDF document] (71)

71

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 3: Solution with XCP

Data from CANape to ECU

Data from ECU to CANape

Matlab Simulink DLL in CANapeu - [PDF document] (72)

72

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 3: Solution with XCP

As a workaround, a regular desktop computer is the platform on which to run the model. In the example, the measurement lasted 6 hours!

Delay

50000

100 000

150 000

200 000

250 000

300 000

350 000

400 000

450000

Time

/ Pani

0,20

480,

4096

0,61

440,

8192

1,02

4

1,22

881,

4336

1,63

841,

8432

2,04

82,

2528

2,45

762,

6624

2,86

72

3,07

2

3,27

68

Delay

Lap time measured in ECU!

Delay range: 0.4-1.6ms

tn1 tn2∆t = n1 tn2

A2L driver

1.

2.

3.

4.

computer

Model.A2L6.

5.

ECU

XCP

A2L driver

1.

Simulink-DLL2.

3.

4.

computer

Model.A2L6.

5.

ECU

XCP

Matlab Simulink DLL in CANapeu - [PDF document] (73)

73

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 3: Solution with XCP

met with RS 232

slave slave

SxI

AND AND

DPRAM

ETH

RS232

CAPABLE OF

rob

Ethernet

CAPABLE OF

rob

USB

USB

DLL

rob

To ##

na CANon USB-u

is SxI

on an Ethernet network on an Ethernet network on an Ethernet network

rob a slave rob

LIN

LIN

LIN door

F

L

X

w FlexRay’u

FlexRay

rob

Matlab Simulink DLL in CANapeu - [PDF document] (74)

74

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

daily routine

Use Case 4: Generate CAN messages with Simulink DLL>

Use case 3: Solution with XCP

Use case 2: Simulink DLL as an offline analysis tool

Use case 1: Simulink DLL during online measurements

Model researcher

Integrate the Simulink DLL with CANape

Defining signals and parameters

Create a Simulink DLL based on the Simulink model

Create a Simulink model

Matlab configuration

Installing CANape Realtime Target

Version/software information

Matlab Simulink DLL in CANapeu - [PDF document] (75)

75

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

❑ Integrate the new device

❑ Select "CAN" as the driver type.

❑ Select the correct DBC file as the database

Use case 4: Generate CAN messages using the Simulink DLL

Matlab Simulink DLL in CANapeu - [PDF document] (76)

76

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Assign the DLL's output value to the signal in the DBC

Use case 4: Generate CAN messages using the Simulink DLL

Start measurement in CANape. By changing the value of the selected "Channel 1" signal, CANape will generate a new message and send it to the bus.

Matlab Simulink DLL in CANapeu - [PDF document] (77)

77

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Use case 4: Generate CAN messages using the Simulink DLL

This message was generated by CANape because the DLL changed the signal value "Channel1"

Matlab Simulink DLL in CANapeu - [PDF document] (78)

78

© 2007. Vector Informatik GmbH. All rights reserved. Any distribution or copying requires Vector's prior written consent.

Is:

Thank you for your attention.

For details on Vector

and see our products:

www.vector-informatik.com

Author:

[email protected]

[email protected]

VectorInformatik 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 owners.

References

Top Articles
Latest Posts
Article information

Author: Catherine Tremblay

Last Updated: 04/25/2023

Views: 6039

Rating: 4.7 / 5 (47 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Catherine Tremblay

Birthday: 1999-09-23

Address: Suite 461 73643 Sherril Loaf, Dickinsonland, AZ 47941-2379

Phone: +2678139151039

Job: International Administration Supervisor

Hobby: Dowsing, Snowboarding, Rowing, Beekeeping, Calligraphy, Shooting, Air sports

Introduction: My name is Catherine Tremblay, I am a precious, perfect, tasty, enthusiastic, inexpensive, vast, kind person who loves writing and wants to share my knowledge and understanding with you.