CANoe Matlab en
CANoe Matlab en
CANoe Matlab en
AddOn
MATLAB
Interface
User Guide
Version 1.7
Vector Informatik GmbH, Ingersheimer Str. 24, D-70499 Stuttgart
Tel. +49 711 80670-0, Fax +49 711 80670 555,
Email can@vector-informatik.de, Internet http://www.vector-informatik.de
i
Subsidiaries
France
Vector France SAS
168, Boulevard Camlinat
F-92240 Malakoff
Tel.: +33 (1) 4231 4000
Fax: +33 (1) 4231 4009
information@vector-france.com
http://www.vector-france.com
Japan
Vector Japan Co., Ltd.
Seafort Square Center Bld. 18F
2-3-12, Higashi-shinagawa, Shinagawa-ku
J-140-0002 Tokyo
Tel.: +81 3 5769 6970
Fax: +81 3 5769 6975
info@vector-japan.co.jp
http://www.vector-japan.co.jp
Sweden
VecScan AB
Lindholmspiren 5
SE-417 56 Gteborg
Tel.: +46 (31) 76476 00
Fax: +46 (31) 76476 19
info@vecscan.com
http://www.vecscan.com/
USA
Vector CANtech, Inc.
Suite 550
39500 Orchard Hill Place
USA-Novi, Mi 48375
Tel.: +1 (248) 449 9290
Fax: +1 (248) 449 9704
info@vector-cantech.com
http://www.vector-cantech.com
For Distributor Addresses please have a look on our website:
www.vector-informatik.com
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
ii
International Quality Standard Certificate
The Quality/Process Management of Vector Informatik GmbH is being certified
according to DIN EN ISO 9001:2000-12 (formerly DIN EN ISO 9001:1994-08)
throughout since 1998-08-19.
Typographic Conventions
Note:
Identifies important notes
Identifies enumerations (bullet items)
'1.0 Introduction' Identifies references to further chapters of this manual
[OK] Notation for buttons in dialogs
<TAB> Notation for keys on the computer keyboard
<Ctrl>+<Z> Notation for keys of the computer keyboard which should be
pressed simultaneously
Add
FileFile open
Notation for menu, command and dialog names
on message 0x100 Notation for MS-DOS syntax or program code
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
iii
Contents
1 Introduction..........................................................................................................1
2 Execution Modes .................................................................................................2
2.1 Offline Mode..................................................................................................2
2.2 Hardware-In-The-Loop (HIL) Mode...............................................................3
3 Modeling Concepts..............................................................................................4
3.1 Software Layers of an ECU...........................................................................4
3.2 Interaction Layer ...........................................................................................5
3.3 CANoe Interaction Layer ...............................................................................5
3.4 Application.....................................................................................................6
3.5 Definition of Concepts ...................................................................................6
3.5.1 Middleware .......................................................................................6
3.5.2 Interaction Layer...............................................................................6
3.5.3 Transport Layer ................................................................................6
3.5.4 Network Management Layer.............................................................7
4 Setup.....................................................................................................................8
4.1 General .........................................................................................................8
4.2 Matlab ...........................................................................................................8
4.3 Verification.....................................................................................................8
4.4 CANoe...........................................................................................................9
4.5 CANoe Interaction Layer .............................................................................10
4.5.1 Database preparation .....................................................................10
4.5.2 Configuration Setup from scratch ................................................... 11
4.6 Customize a Matlab Simulink
Settings ..........................................................................12
4.7 Customize a Matlab Simulink
Settings ..........................................................................14
4.7.2 CANoe Settings..............................................................................16
4.8 Configuration and Test of CANoe Simulink
Blocks ....................................20
4.8.1 Signal Block Configuration..............................................................20
4.8.2 Test of CANoe Blocks.....................................................................22
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
iv
5 Sample Configurations .....................................................................................24
5.1 Sine Sample Configuration..........................................................................24
5.1.1 Offline Mode ...................................................................................24
5.1.2 Hardware-In-The-Loop (HIL) Mode ................................................24
5.2 Sine Parameterization Configuration...........................................................25
5.3 Signal Access Sample Configuration ..........................................................25
5.4 SF_Auto_SignalAccess Sample Configuration ...........................................26
5.5 Automot Sample Configuration ...................................................................28
5.6 Trigger Sample Configuration......................................................................29
5.6.1 Triggering by Environment Input.....................................................29
5.6.2 Triggering by Environment Event....................................................29
5.6.3 Using Different Targets ...................................................................30
6 CANoe I/O Library..............................................................................................31
6.1 Signal Input .................................................................................................32
6.2 Signal Output ..............................................................................................32
6.3 Signal Block ................................................................................................32
6.4 Message Input.............................................................................................34
6.5 Message Output ..........................................................................................34
6.6 Simulation Step ...........................................................................................35
6.7 CAPL Call....................................................................................................35
6.8 CAPL Handler .............................................................................................36
6.8.1 Environment Event .........................................................................37
6.9 Environment Input .......................................................................................37
6.10 Data Environment Input...............................................................................38
6.11 Environment Output ....................................................................................38
6.12 Data Environment Output ............................................................................38
6.13 Environment Step........................................................................................38
6.14 Environment Trigger ....................................................................................39
6.15 System Variable Input .................................................................................40
6.16 System Variable Output...............................................................................41
7 CAPL Functions.................................................................................................42
7.1 General .......................................................................................................42
7.2 MODEL_init .................................................................................................42
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
v
7.3 MODEL_step...............................................................................................43
7.4 Parameterization Functions.........................................................................43
7.4.1 MODEL_getParameter ...................................................................44
7.4.2 MODEL_setParameter ...................................................................44
7.4.3 MODEL_setScalarParameter .........................................................44
8 Utilities................................................................................................................45
8.1 Setup of environment blocks.......................................................................45
8.2 Setup of signal and environment blocks......................................................46
9 Troubleshooting.................................................................................................48
9.1 Unusable CANoe GUI during offline simulation...........................................48
9.2 Unable to compile the nlapml.cpp source file. .............................................48
9.3 Spaces in MATLAB
interface was designed to combine the strengths of both simulation tools.
CANoe is a total network simulation tool designed to both model nodes on a network
and the network that binds them. Traditionally the functionality of these network
nodes are modeled using the CAPL language provided with CANoe. The purpose of
this interface is to extend CANoes node modeling capability by adding the strength
of the MATLAB
/ Simulink
environment.
Now models can be used to describe the functionality of a network node in CANoe.
This allows CANoe to simulate nodes which are impossible or difficult to model using
CAPL alone. Another feature would be to use a Simulink
model to generate an
outside stimulus to an existing CAPL node.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
2
2 Execution Modes
Simulations utilizing this interface can be operated in two different modes:
Running a simulation in MATLAB
/ Simulink
.
This is an offline simulation mode.
Running a simulation in the CANoe execution environment.
This is a real-time or Hardware-In-The-Loop (HIL) simulation mode.
2.1 Offline Mode
In this mode the simulation is run in the MATLAB
Simulink
environment. CANoe is
operated in Slave mode whereas MATLAB
Simulink
Simulink
environment.
CANoe's Slave mode is a special simulation mode whereby CANoe is simulating the
(CAN) bus and takes its measurement time base from outside (here: from Simulink
).
This is especially useful in early design stages. Debugging features of the MATLAB
environment can be used. Communication between MATLAB
Simulink
and CANoe
takes place over Microsoft
DCOM.
You cannot perform real-time simulation with this kind of simulation.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
3
2.2 Hardware-In-The-Loop (HIL) Mode
In this mode the simulation is run in the CANoe execution environment. With the
Simulink
Real-Time Workshop
DLL which can be loaded in CANoe's simulation environment. One DLL must be
generated per node. With this approach it is possible to test and verify your design
with real (CAN) hardware in a networked environment. The simulation can be used
as a simulation of the remainder of the bus in a real-time environment. Several ECUs
can be simulated simultaneously within a single CANoe environment. This mode
must be used if it is necessary to simulate the remaining bus in real time.
Requirements: Simulink
Real-Time Workshop
.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
4
3 Modeling Concepts
It is important to understand how this interface communicates with CANoe in order to
easily design a model.
It is easiest to think of the CANoe/MATLAB
interface an extension or a complete
replacement of existing CAPL code. The application of a CAPL node can be
completely implemented with Simulink
.
It is possible to design an entire ECU in Simulink
Simulink
and Stateflow
R12
Visual C++
6.0
CANoe/MATLAB
/RTW
6.0 R12
Microsoft Visual C++
).
Note: This note applies to CANoe versions lower than CANoe 3.1.15.
These CANoe versions need the DEMO driver to switch to Slave mode.
You have to install CANoe with the Custom Setup option to install the
DEMO driver.
To set CANoe to the Slave mode do the following:
Exit CANoe if it is running.
Install the DEMO driver:
$(CANOEROOT)\Exec32\Batch\CANdem32.BAT.
Open the CAN.INI configuration file.
Under the [System] section edit the following entry (i.e. set it to 1):
ExternalDemoSimulationTime=1.
Append the following entry (this will increase the performance in Slave mode
operation):
SingleStepSimulationTime=1.
(Re)start CANoe and open the configuration with which you want to work.
Select the "Simulation" item from the "Configure" menu.
Set the Working mode to Simulated bus and select an Animation factor of
"1.0000".
Save your changes.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
10
4.5 CANoe Interaction Layer
The CANoe Interaction Layer is used to access signals from Simulink
directly.
Several preliminary steps have to be taken before the CANoe Interaction Layer can
be utilized.
Note: The signal access blocks of the CANoe I/O library can only be used with
CANoe versions 5.1. SP3 or later.
4.5.1 Database preparation
The database must contain several attributes to use it with the Vector Interaction
Layer. You can import these attribute definitions from the Vector_IL_Basic template
dbc file.
Database attributes to use the Vector Interaction Layer:
Object type Database attribute Description
BusType Defines the bus type, here CAN Network
NmBaseAddress OSEK NM attribute
Node NmStationAddress OSEK NM attribute
NmMessage Identifies a NM message Message
GenMsgStartDelayTime Delay of cyclic sendings after the start of the Vector IL
GenMsgSendType Send type of the message
GenMsgNrOfRepetition Number of repetitions for send types OnWriteWithRepetition,
OnChangeWithRepetition and IfActiveWithRepetition
GenMsgILSupport Defines the support of the Vector IL for this message
GenMsgFastOnStart Fast cyclic sending on start of the Vector IL
GenMsgDelayTime Minimum delay time between two sendings of the message
GenMsgCycleTimeFast Cycle time used by send types IfActive and for messages
using attribute GenMsgFastOnStart
GenMsgCycleTime Cycle time for send type cyclic
NWM-WakeupAllowed Allows a signal to wake up the network Signal
GenSigStartValue Start value of the signal
GenSigSendType Send type of the signal
GenSigInactiveValue Inactive value of the signal used by the send types
IfActive
You can find more information about the Vector IL send types in the CANoe Online
Help (CAPL Generator Interaction Layer Vector Interaction Layer)
Network management:
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
11
The communication between the network management and the Vector Interaction
Layer doesnt need any CAPL code. If you dont want to use the OSEK NM please
remove the entry dmoseknm.dll within the database attribute NodeLayerModules.
All the greyed database attributes in the overview above can be removed from the
database if there is no need to use the OSEK NM.
4.5.2 Configuration Setup from scratch
Starting from a pre-configured dbc file you can automatically generate a CANoe
configuration. Please take the following steps:
1. Prepare a new directory that shall contain the simulation configuration. There,
create the folder candb and copy your network database into this folder.
The nodes will be generated to the folder <Database-folder>/../Nodes.
The panels will be generated to the folder <Database-folder>/../Panels.
2. The exec32\ModelGeneration folder of your CANoe installation contains a
Model Generation Wizard. A link can also be found in the CANoe start menu in
the Tools folder. Start the wizard and select your network database. The output
folder for the new configuration is set automatically. Choose [Generate] to
create the configuration.
Figure 2: Model Generation Wizard
3. CANoe is started automatically. The Simulation creation runs about up to 2
minutes, depending on your hardware configuration and the complexity of the
model. You can track the status of the generation within the write window of
CANoe.
Note: Please do not operate CANoe before the message
Vector Simulation creation finished. has occurred there.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
12
Additional information for the automatic generation
The original database will be saved as *.bak file before the creation of the
simulation model.
The run of the automatic simulation creation requires the confirmation of the
disclaimer of CANoe.
Trouble-shooting of the automatic generation
If the automatic simulation creation fails, then please check the following topics:
Start CANoe manually. Is it possible to start CANoe without the confirmation of
dialogs, maybe error-dialogs?
In this case please start CANoe manually, load a demo-configuration, and
close CANoe.
Is CANoe currently running? If yes, is the currently active configuration already
saved?
If the currently running configuration is not yet saved, then save it.
Do you have multiple installations of CANoe onto your system?
The generation must use the CANoe you have installed at last.
4.6 Customize a Matlab Simulink
It may be helpful to copy the Simulink model file (*.mdl) into the same folder as the
CANoe configuration (*.cfg). If you want to use the generated DLL, create a subfolder
named Exec32 for example. The Real-Time Workshop
Settings
The CANoe interface for Matlab needs some settings of the Simulink model which
are described here. Choose Simulation | Configuration Parameters to open the
settings dialog.
The Real-Time Workshop must be configured with the correct target for CANoe
(cn.tlc). Otherwise the CANoe Matlab interface blocks cant be used.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
13
Figure 3: Target Selection
Interface
If you want to parameterize the model from CANoe activate the C-API Interface for
parameters. Please note that this setting is available with Matlab R14 and newer:
Figure 4: C-API Interface Settings
CN code generation options
The CN target has some specific options for the code generation process. First of all
the output directory can be set. If nothing is specified the DLL will be generated in the
Settings
The CANoe interface for Matlab needs some settings of the Simulink model which
are described here. Choose Simulation | Configuration Parameters to open the
settings dialog.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
15
Optimization
The Inline Parameters option on the Optimization page defines which model
parameters are accessible. If the option is deactivated, all parameters of every
Simulink
block will be accessible. The number of parameters and their names might
differ from the ones configurable in Simulink
Blocks
Note: This chapter only applies to Matlab R14 and newer. CANoe 7.0 SP3 and
newer must be used.
4.8.1 Signal Block Configuration
CANoe signals can normally be identified by four parameters:
1. Database name
2. Node name (the node which sends the message)
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
21
3. Message name (the message containing the signal)
4. Signal name
By double clicking CANoe signal blocks a selection dialog appears containing all
signals of the current CANoe configuration. The dialog also sets the parameters of
the signal block so that it uses the currently selected signal.
Since version 1.7 of the Matlab Interface the parameters 1. to 3. are optional. If the
signal name is unique, database, node and message name are set to a space
character ( ). If two messages contain signals with the same name, an additional
message name will be set to resolve the ambiguity. This also applies to the node and
database name. The use of unique signal names simplifies the development of
models in early development stages where database and node name might change
frequently.
Figure 11: Full signal qualification Figure 12: Unique signal name
Note: The use of unique signal names is not compatible with older versions of
prompt:
VSignalQualification(model_name, 1); %full qualification
VSignalQualification(model_name, 0); %use unique names
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
22
Code Generation
Signal names must be fully qualified if the complied model should work with versions
of CANoe older than 7.0 SP3. This can easily be achieved by using the m-function
described above or by checking the CN code generation option Use full signal
qualification for compilation:
Figure 13: Signal Qualification Option
The VSignalQualification function is called twice during the compilation process if the
option is enabled. It automatically switches to full signal qualification before the code
is generated and sets back the unique names at the end.
4.8.2 Test of CANoe Blocks
Interface provides custom checks for the Simulink The CANoe Matlab Model
Advisor. Please make sure that CANoe has opened a configuration containing all
databases used by the model before running these checks. The Model Advisor will
report all CANoe blocks which are not configured correctly.
By following the links of erroneous blocks in the Model Advisor report, Simulink
opens the correct sub system and highlights the block. Using the Model Advisor it is
very easy to find all CANoe blocks that wont work properly with the current CANoe
configuration.
The Model Advisor checks can be run automatically during compilation if the CN
code generation option Check CANoe block configuration at compilation is enabled.
Note: With Matlab
R14 this option just opens the Model Advisor and doesnt
interrupt the compilation process if errors are detected. Using R2006a and
newer the compilation process is stopped if the Model Advisor detects any
erroneous CANoe block and opens the report. If all blocks are configured
correctly the compilation is resumed.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
23
Figure 14: Model Advisor Report
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
24
5 Sample Configurations
The actual chapter describes some sample configurations as examples for different
purposes.
5.1 Sine Sample Configuration
This simple configuration shows the minimum settings for a CANoe configuration and
database necessary to load and execute a Simulink
model.
5.1.1 Offline Mode
Notice the Environment Out, and Simulation Step blocks. The Environment Out block
specifies that the sines output will be associated with EnvFloat environment variable.
The Simulation Step block is required when running in slave mode. It is used to
control CANoes timing from Simulink
model
A sine wave should be displayed in the graphics window. Enter a value for signal
SigModelInput into the simulink panel in CANoe. This value is used as a multiplier
for the amplitude of sine wave 2 in the model. The output of sine wave 2 is mapped
to the signal SigResult and should now also be displayed in the graphics window.
5.4 SF_Auto_SignalAccess Sample Configuration
Note: This sample configuration will only work with CANoe 5.1 SP3 and newer.
For earlier CANoe versions there is an alternative model available
(SF_Car) which interfaces to CANoe via environment variables.
This sample only applies to MATLAB
.
You will find this model in:
$(MATLABROOT)\work\samples\
SF_Auto_SignalAccess\Models\sf_car.mdl
It contains seven CANoe specific signal input/output blocks:
BreakForce
EngineRunning
PedalPosition
EngSpeed
Gear
CarSpeed
The Simulation step block is only relevant to the Simulink Simulation. It will be
discussed later
When you build the model a folder (sf_car_cn_rtw) containing several files generated
during the code building process is made in the current MATLAB
working directory.
To specify a destination for the DLL file generated you must first specify the
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
27
compiler's output directory. Select the RTW Options item from the Tools menu
and click the [Options] button. In the editing box labeled Output Directory specify
your directory:
$(CANOEROOT)\Exec32
Note: If the $(CANOEROOT) directory path contains spaces
C:\Program files\CANoe (e.g.: ) you must specify the MS-DOS name
C:\Progra~1\CANoe (usually: ).
Use the Explorer to find the MS-DOS name.
If nothing is specified the DLL will be generated in the
..\sf_car_cn_rtw\release\ directory and must be copied manually to
$(CANOEROOT)\Exec32.
Note: This note applies to MATLAB R12.
To specify the Output Directory open the Category combo box and select
the CN code generation options.
Additional settings in the Simulation Parameters dialog:
1. Export CAPL-Function: With this option activated two special CAPL functions
are exported by the generated DLL. Refer to '7.0 CAPL-Functions' for more
details.
2. Enable Parameterization from CANoe: If this option is activated values of all
model parameters are accessible from CANoe. Refer to '5.2 Sine
Parameterization Configuration' for an example.
models have been added to the Simulation Setup. Before you open
this configuration you should first build the actual DLLs for these models. If you open
it beforehand you will get two warning messages indicating that CANoe cannot find
them you can safely ignore these messages at this time but you will not be able to
start the measurement.
The first model engine.mdl implements a simple vehicle speed control system.
Vehicle and engine speed are the input variables and the speed is controlled as a
function of the pedal position and gear. You will find this model in:
$(MATLABROOT)\work\samples\Auto\Models\engine\engine.mdl
Open the model in MATLAB
The first block Simulation step is only relevant to the Simulink Simulation. It will
be discussed later. The others are two Environment Input and Output blocks
respectively. They read and write directly to the corresponding CANoe environment
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
29
variables. Double click on the Environment blocks to see the actual controlled
variable names.
The second model door_ri.mdl lowers the window of the right door automatically
to the lowest position when the user presses the window down button longer than a
specified time. You will find the model in:
$(MATLABROOT)\work\samples\Auto\Models\door_ri\door_ri.mdl
Generate code for the models as described in the SF_Car_SignalAccess example
above. For your convenience you will find all prebuilt DLLs in:
$(MATLABROOT)\work\samples\Auto\DLL
After you have generated code
Start CANoe and open the configuration:
$(MATLABROOT)\work\samples\Auto\automot.cfg
Note: If youre using CANoe 4.0 or newer open the configuration:
$(MATLABROOT)\work\samples\Auto\automot4.cfg
Select Compile all nodes from the Configure menu.
(Configure | Compile all nodes)
To verify that CANoe has detected the two DLLs select View | Simulation
Setup to have the Simulation Setup window pop up.
The Engine node should display a RTW string in its second description line.
The DOOR_ri node should display RTW,nm28:2.
Start the measurement to view the models in action.
Select the Gateway panel and set the Ignition switch to 3 (right mouse click)
and press the [Starter] button.
Select the Control panel and press the [Powertrain Bus] button to open the
Engine panel.
View the pedal position controlled by the engine model.
Try the [Brake] button.
Play with the window up and down buttons of the right-side doors on the
Console panel and watch the effects on the Door right panel.
5.6 Trigger Sample Configuration
This example shows how to use CANoe events to trigger Simulink subsystems.
Furthermore it introduces the concept of using a Simulink
library for the actual model
and targeting of different hardware and/or software environments.
5.6.1 Triggering by Environment Input
The Simulink model trigsub1.mdl uses an Environment Input block to trigger the
subsystem. The subsystem trigger is configured as an either edge trigger.
5.6.2 Triggering by Environment Event
The Simulink model trigsub2.mdl uses an Environment Event block to trigger the
subsystem. The subsystem trigger is configured as a function-call trigger. In this
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
30
simple example the actual value of the Environment Event block variable is not used
and it is therefore connected to a terminator.
5.6.3 Using Different Targets
The Simulink models trigsub3.mdl and trigsub4.mdl use a subsystem which is
defined in the trigsub.mdl Simulink
library. The trigsub3.mdl model targets CANoe
whereas the trigsub4.mdl model targets a VxWorks environment. Using a Simulink
library for the actual model (here: Triggered Subsystem) makes it easy for you to
target different environments while providing a single point of maintenance for your
application model.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
31
6 CANoe I/O Library
The CANoe I/O library is a collection of S-Functions blocks.
Figure 15: CANoe I/O library
The library provides the following features:
Data I/O
Trigger sources
Event sinks
Model execution control
CANoe simulation control
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
32
6.1 Signal Input
The Signal Input block is the basic input block for a database signal. It is configured
with the signal name, message name, node name and database name. It contains
the additional parameter Sample Time. According to Simulink
semantics:
0 = continuous sample time
-1 = inherited sample time
Continuous sample time is set as default. If the Signal Input block is used in a
triggered subsystem for example, the sample time must be set to inherited because
only constant blocks or blocks with an inherited sample time are allowed in triggered
subsystems.
The access to signals is provided through the Vector Interaction Layer. Please refer
to 4.5 CANoe Interaction Layer for information about preliminary steps.
For further information on the CANoe Interaction Layer see CANoe online help.
Compatibility: RTW Offline CANoe 5.1 SP3 and later
X X
6.2 Signal Output
The Signal Output block is the basic output block for a database signal. It is
configured with the signal name, message name, node name and database name.
The access to signals is provided through the Vector CANoe Interaction Layer.
Please refer to 4.5 CANoe Interaction Layer for information about preliminary steps.
For further information on the CANoe Interaction Layer see CANoe online help.
Compatibility: RTW Offline CANoe 5.1 SP3 and later
X X
6.3 Signal Block
This block allows the user to collect a number of Signal Input and Signal Output block
into one subsystem and configure them by one step. This block consists of an empty
subsystem which can be configured by a Matlab
GUI.
Add Signal Output Adds Signal Output blocks to the subsystem
Add Signal Input Adds Signal Input blocks to the subsystem
Delete Removes the selected signal
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
33
Figure 16: Configuration of the Signal Block
The example above results in the following Signal Block:
Figure 17: Configured Signal Block
Under the hood Signal Input and Signal Output blocks are created and configured
with database name, node name, message name and signal name.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
34
Compatibility: RTW Offline CANoe 5.1 SP3 and later
X X Matlab R14 and later
6.4 Message Input
The Message Input block serves as input block for all signals of a database
message. The values of the signals are output as a vector from the block. Double
click the block to select a message. The block will be configured with the message
name, node name and database name. It contains the additional parameter Sample
Time accessible from the dialog Mask Parameters. According to Simulink
semantics:
0 = continuous sample time
-1 = inherited sample time
Continuous sample time is set as default. If the Message Input block is used in a
triggered subsystem for example, the sample time must be set to inherited because
only constant blocks or blocks with an inherited sample time are allowed in triggered
subsystems.
The access to the signals of a message is provided through the Vector Interaction
Layer. Please refer to 4.5 CANoe Interaction Layer for information about preliminary
steps.
For further information on the CANoe Interaction Layer see CANoe online help.
Compatibility: RTW Offline CANoe 5.1 SP3 and later
X X Matlab R14 and later
6.5 Message Output
The Message Output block serves as output block for all signals of a database
message. It receives the values of the signals as a vector. Double click the block to
select a message. The block will be configured with the message name, node name
and database name.
The access to signals of the message is provided through the Vector Interaction
Layer. Please refer to 4.5 CANoe Interaction Layer for information about preliminary
steps.
For further information on the CANoe Interaction Layer see CANoe online help.
Compatibility: RTW Offline CANoe 5.1 SP3 and later
X X Matlab R14 and later
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
35
6.6 Simulation Step
The Simulation Step block is used to control the CANoe simulation from within
Simulink
. You must place this block in your model if you wish to run CANoe in Slave
mode during a simulation within Simulink
this block
performs nothing.
Compatibility: RTW Offline
X
6.7 CAPL Call
The CAPL Call block can be used to trigger a Simulink
The CAPL Handler block can be used to handle a Simulink event in CAPL.
Figure 19: CAPL Handler block
The CAPL Handler block is configured with a function name. If the attached CAPL file
implements this function it will be called whenever the Simulink
subsystems.
Figure 20: Environment Event block
The Environment Event block is configured with an environment variable name. The
trigger port fires whenever the input variable changes.
Compatibility: RTW Offline
X X
6.9 Environment Input
The Environment Input block is the basic input block for a CANoe environment
variable. It is configured with an environment variable name. It contains the additional
parameter Sample Time. According to Simulink
semantics:
0 = continuous sample time
-1 = inherited sample time
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
38
Continuous sample time is set as default. If the Environment Input block is used in a
triggered subsystem for example, the sample time must be set to inherited because
only constant blocks or blocks with an inherited sample time are allowed in triggered
subsystems.
Compatibility: RTW Offline
X X
6.10 Data Environment Input
The Data Environment Input block is used for an environment variable of type data.
The bytes of the environment variable are output as a vector from the block.
Compatibility: RTW Offline
X X Matlab R12 and later
6.11 Environment Output
The Environment Output block is the basic output block for a CANoe environment
variable. It is configured with an environment variable name.
Compatibility: RTW Offline
X X
6.12 Data Environment Output
The Data Environment Output block is used for an environment variable of type data.
It receives the bytes of the environment variable as a vector.
Compatibility: RTW Offline
X X Matlab R12 and later
6.13 Environment Step
The Environment Step block is used to designate a Simulink model that is executed
only when one of its CANoe environment inputs changes. This is particularly useful
for a model whose outputs are a direct function of its inputs and only need to be
updated when the inputs are changed.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
39
Figure 21: Environment Step block
Note: The Environment Step block should only be used if the Simulink model
does not contain any continuous or discrete blocks.
Compatibility: RTW Offline
X
6.14 Environment Trigger
semantics:
0 = continuous sample time
-1 = inherited sample time
Continuous sample time is set as default. If the System Variable Input block is used
in a triggered subsystem for example, the sample time must be set to inherited
because only constant blocks or blocks with an inherited sample time are allowed in
triggered subsystems.
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
41
Compatibility: RTW Offline CANoe 7.0 and later
X X Matlab R14 and later
6.16 System Variable Output
The System Variable Output block is the basic output block for a CANoe system
variable. It is configured with the name space name, system variable name and an
array index for accessing only one value of an array system variable.
Compatibility: RTW Offline CANoe 7.0 and later
X X Matlab R14 and later
Vector Informatik GmbH CANoe AddOn MATLAB Interface User Guide Version 1.7
42
7 CAPL Functions
7.1 General
The RTW generated DLL contains two additional functions which can be called by
CAPL. These functions may be used to control the behavior of the generated
CANoe/MATLAB
Interface and the execution of the Simulink model. The function
names are in the form
.
If the user wants to execute the MODEL non-cyclically at arbitrary sample times (for
example with the MODEL_step function) the user must disable the CANoe/
MATLAB