CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to...
Transcript of CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to...
![Page 1: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/1.jpg)
V0.1 | 2019-04-17
CAPL (Communciation Access Programming Language)
For CANalyzer and CANoe
CAPL Scripting Quickstart
![Page 2: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/2.jpg)
u Before Getting Started
Visual Sequencer (GUI Based Programming)
Brief Introduction to CAPL
Panel Creation and CAPL
Additional Information
Contact Information
Agenda
2
![Page 3: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/3.jpg)
EthernetMOST
FlexRayLIN
CAN
Simulation Test
AnalysisDiagnostics
CANoe
Difference between CANalyzer and CANoe
Before Getting Started
u CANoe offers significant additional capability beyond CANalyzer to:
> Stimulate the network(s) with Interaction Layer knowledge
> Run automated tests and generate test reports
> Implement automated diagnostic tests
CANalyzer
3
![Page 4: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/4.jpg)
u The CANoe Interaction Layer (in short CANoeIL):
> Provides a signal-oriented means of accessing the bus
> Map signals to their appropriate send messages
> Controls the sending of these messages as a function of the (OEM) Send Model
u Transmission of messages and signals is described based on attributes in the database
u CANoeIL models the transmission behavior at run-time using those attributes
CANoe Interaction Layer
Before Getting Started
4
![Page 5: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/5.jpg)
CAPL is available in CANalyzer PRO and all versions of CANoe
CANalyzer is available in three different variants:
u PRO: Professional variant: full functionality
u EXP: Expert variant: supports all applications up tocomplex analysis of heterogeneous systems; does not support CAPL programs
u FUN: Fundamental variant: simple applications, does notsupport CAPL, diagnostic tester and panels
Detailed information about the variants of CANalyzer is available at our website: http://www.vector.com/vi_canalyzer_variants_en.html
CAPL Support
Before Getting Started
5
![Page 6: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/6.jpg)
Before Getting Started
u Visual Sequencer (GUI Based Programming)
Brief Introduction to CAPL
Panel Creation and CAPL
Additional Information
Contact Information
Agenda
6
![Page 7: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/7.jpg)
u Available in both CANalyzer PRO and EXP as well as CANoe> Intended to allow some automation within the EXP variant
u The Visual Sequencer allows you to create automated command sequences with the purpose of> Stimulating the network
> Controlling applications
u In order to structure the individual steps, loops and conditional command blocks can be used, such as > if, else if, end if
u Each sequence is shown in a separate window, and can be edited at any time, even while a measurement is running.
General
Visual Sequencer (GUI Based Programming)
7
![Page 8: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/8.jpg)
u Send messages (cyclically)
u Set signals/variables
u If, else, else if and repeat commands
u Wait commands
u Start/stop replay
u Write text or valuesto write window or file
u Graphical debug
u Auto complete for names
Features
Visual Sequencer (GUI Based Programming)
8
![Page 9: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/9.jpg)
See Sample Configuration: CAN System Demo (CANsystemdemo.cfg)
Visual Sequencer (GUI Based Programming)
9
![Page 10: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/10.jpg)
Before Getting Started
Visual Sequencer (GUI Based Programming)
u Brief Introduction to CAPL
Panel Creation and CAPL
Additional Information
Contact Information
Agenda
10
![Page 11: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/11.jpg)
Functional blocks based on CAPL (Communication Access Programming Language) can be created to program
u Network node modules
u Special evaluation programs for individual applications
Some CAPL characteristics:
u C-like programming language
u Event based, not interrupt driven
u CAPL programs are created using an integrated development environment called the CAPL Browser
u Direct access to signals, system variables and diagnostic parameters
u Able to link user created DLLs
General
Brief Introduction to CAPL
11
![Page 12: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/12.jpg)
u Creating and extending simulations
u Implementing functions for analysis in the measurement setup
CANoe
Brief Introduction to CAPL
Simulation Setup Measurement Setup
12
![Page 13: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/13.jpg)
u Creating simulations or reactive scripts
u Implementing functions for analysis in the measurement setup
CANalyzer
Brief Introduction to CAPL
Send Loop of the Measurement Setup Analysis Branches
13
![Page 14: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/14.jpg)
CAPL Browser
Brief Introduction to CAPL
Compiler Messages
Browser Tree
(List of Events)
Symbols and
Functions
Editor
14
![Page 15: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/15.jpg)
u In order to generate an executable program file from a CAPL program, the program must be compiledwith the CAPL compiler:
u Error messages are shown in the lower Message Window:
When you double-click the error description, the cursor in the Text Editor automatically jumps to the point in the source code, where the error originated.
Compiling
Brief Introduction to CAPL
15
![Page 16: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/16.jpg)
u Additional CAPL files that contain generic code that can be reused in other programs
u Variables defined here are accessible throughout the CAPL program
u Multiple pre-defined event handlers exist for your use within CAPL. The code in this handler will only be executed when the event occurs.
u You can create your own functions (special handler) that contain related code to be executed frequently
Examining a CAPL Program
Brief Introduction to CAPL
16
![Page 17: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/17.jpg)
CAPL is a procedural language in which the execution of program blocks is controlled by events. These program blocks are referred to as event procedures.
Adding Event Handlers
Brief Introduction to CAPL
17
![Page 18: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/18.jpg)
Important Event Handlers (CAN)
Brief Introduction to CAPL
u Start of measurement
u Message received
u Signal change
u Time event
u Key press
on Start
{
write ("Start of CANoe");
}
on signal sigTemp
{
write ("Signal Temperature");
}
on timer tmrCycle
{
write ("within cycle");
}
on key 'a'
{
write ("Key >a< pressed");
}
on message 0x123
{
write ("CAN Message 123");
}
18
![Page 19: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/19.jpg)
on key 'a' // React to press of ‘a’ key
on key ' ' // React to press of spacebar
on key 0x20 // React to press of spacebar
on key F1 // React to press of F1 key
on key ctrlF12 // React to press of Ctrl-F12
on key PageUp // React to press of Page Up key
on key Home // React to press of Home key
on key * // React to any key press except…
On Key Procedures
Brief Introduction to CAPL
19
![Page 20: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/20.jpg)
Data Types for CAN
Brief Introduction to CAPL
Type Name Bit Note
Integers Signed
Unsigned
int
long
int64
byte
word
dword
qword
16
32
64
8
16
32
64
Floating point float
double
64
64
Per IEEE
Per IEEE
Single character char 8
Message variable for CAN message for CAN messages
Time variables for seconds
for milliseconds
timer
mstimer
for Timer in s
for Timer in ms
20
![Page 21: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/21.jpg)
Variables in CAPL
Brief Introduction to CAPL
u CAPL code:
int i = 100; // Declaration and initialization of an integer STATIC VARIABLES!!char ch = 'a'; // Declaration and initialization of a characterfloat x; // Declaration of a floating point number
write ("Hundred as decimal number: %d", i);
write ("Hundred as hexadecimal number: %x", i);
write ("Pi as floating point number: %f", pi);
write ("The decimal ASCII code of %c is %d", ch, ch);
write ("The value of x is %f", x);
u Results:
21
![Page 22: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/22.jpg)
String Format Specifiers
Brief Introduction to CAPL
Specifier Description
"%ld","%d" decimal display
"%lx","%x" hexadecimal display
"%lX","%X" hexadecimal display (upper case)
"%lu","%u" unsigned display
"%lo","%o" octal display
"%s" display a string
"%g","%f" floating point display. e.g. %5.3f means, 5 digits in total (decimal point inclusive) and 3 digits after the decimal point. 5 is the minimum of digits in this case.
"%c" display a character
"%%" display %-character
"%I64d","%lld" decimal display of a 64 bit value
"%I64x","%llx” hexadecimal display of a 64 bit value
"%I64X","%llX"
hexadecimal display of a 64 bit value (upper case)
"%I64u","%llu" unsigned display of a 64 bit value
"%I64o","%llo" octal display of a 64 bit value
22
![Page 23: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/23.jpg)
Operators
Brief Introduction to CAPL
Operator Description Example
+ - Addition, subtraction -
* / Multiplication, division -
++ -- Increment or decrement by 1 a++; // increments a by 1
% Modulo division (returns integer remainder of a division)
a = 4 % 3; // a is 1
< <= Less than; less than or equal to returns TRUE or FALSE
> >= Greater than; greater than or equal to returns TRUE or FALSE
== != Compare for equality or inequality returns TRUE or FALSE
&& Logic AND returns TRUE or FALSE
|| Logic OR returns TRUE or FALSE
! Logic NOT changes TRUE to FALSE and vice versa
& Bitwise AND 1 & 7 // yields 1 (0001 & 0111 →
0001)
| Bitwise OR 1 | 7 // yields 7 (0001 | 0111 →
0111)
~ Bitwise complement ~1 // yields 14 (0001 → 1110)
^ Bitwise exclusive OR (XOR) 01^11 // ergibt 10
>> << Bit shift to right or left 1 << 3 // yields 8 (0001 → 1000)
23
![Page 24: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/24.jpg)
Before Getting Started
Visual Sequencer (GUI Based Programming)
Brief Introduction to CAPL
u Panel Creation and CAPL
Additional Information
Contact Information
Agenda
24
![Page 25: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/25.jpg)
u A signal can be mapped to each display or control as simple as drag and drop
u CANalyzer display only controls for signals
Creating a Panel
Panel Creation and CAPL
Drag & Drop
25
![Page 26: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/26.jpg)
u System Variables can be system defined or user defined.
u The variables can be created, saved, imported and exported.
Creating System Variables
Panel Creation and CAPL
26
![Page 27: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/27.jpg)
Before Getting Started
Visual Sequencer (GUI Based Programming)
Brief Introduction to CAPL
Panel Creation and CAPL
u Additional Information
Contact Information
Agenda
27
![Page 28: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/28.jpg)
Online Help File
Additional Information
28
![Page 29: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/29.jpg)
Before Getting Started
Visual Sequencer (GUI Based Programming)
Brief Introduction to CAPL
Panel Creation and CAPL
Additional Information
u Contact Information
Agenda
29
![Page 30: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/30.jpg)
Visit our website:
> http://www.vector.com
Sign in for a Vector training class:
> http://www.vector.com/vi_training_en.html
Need help with Vector tools?
Contact our support team:> (248) 449 – 9290 Option 2
My contact info:> [email protected]
Looking for more information?
Contact Information
30
![Page 31: CAPL Scripting Quickstart€¦ · on key ' ' // React to press of spacebar on key 0x20 // React to press of spacebar on key F1 // React to press of F1 key on key ctrlF12 // React](https://reader036.fdocuments.us/reader036/viewer/2022063012/5fc9073a14ef0f43a247ef63/html5/thumbnails/31.jpg)
© 2019. Vector North America Inc. All rights reserved. Any distribution or copying is subject to prior written approval by Vector. V0.1 | 2019-04-17
Author:Kaschner, ShawnVector North America
Your questions are welcome!