CANoe & CAPL lab (mock)
No licence needed. This is a pretend version of Vector CANoe and CANalyzer that runs in your browser. It works like the real tool in a simplified way, so you can learn how it works by doing: start a measurement, read the trace, change signals, write CAPL scripts and run an automated test.
- CANalyzer = a tool to watch the car network: every message, live.
- CANoe = CANalyzer + it can pretend to be ECUs (send fake speed, temperature…) + run automatic tests.
- CAPL = the small programming language inside CANoe. You write "when X happens, do Y".
Think of it like a flight simulator. The cockpit (the cluster) is real, but the sky, the engines and the weather are simulated by the computer, so you can test every situation safely.
This lab teaches you the ideas and the words. It is not the real tool. If you have not used CANoe in a project, say: "I haven't used a licensed CANoe in a project yet, but I have practised the concepts: trace analysis, the Interactive Generator, panels, CAPL event procedures and test modules, so I can become productive quickly."
CANalyzer vs CANoe in one picture
- In a real car, all ECUs are there, so you only need to watch: CANalyzer is enough.
- On a test bench, only one real ECU is there (the cluster). CANoe pretends to be all the others. That is why HMI test benches use CANoe.
Say: "CANalyzer is mainly for analysis: trace, graphics, logging and sending frames. CANoe adds simulation of the other ECUs, panels, and test modules for automated testing."
How our mock bench is connected
- The dashed ECUs do not exist on the bench. CANoe pretends to be them (this is called rest-bus simulation).
- The cluster is the real device you test. It reads the messages and shows speed, temperature and warnings.
- The cluster also sends a ClusterStatus message (which warnings are on). Automatic tests read it to decide pass or fail.
The windows you will use (same names as in real CANoe)
| Window | What it does (simple) | In the real tool |
|---|---|---|
| Start / Stop (⚡) | Starts the "measurement": the bus comes alive and everything records. | Lightning button or F9 |
| Trace | A live list of every CAN message: time, ID, name, data bytes. Click a line to see the signals inside. | Most-used window for testers |
| Panel | Buttons and sliders to change signals: ignition, speed, temperature, doors. | CANoe only (Panel Designer) |
| Graphics | Draws a signal over time, like a heart monitor. | Very useful to see jumps and flicker |
| Write | Text output: messages from the tool and from your CAPL write(). | For debugging your scripts |
| Interactive Generator (IG) | Type an ID and bytes by hand, press Send. | CANalyzer and CANoe |
| Database (DBC) | The dictionary: which message has which signals, factor, offset, unit. | CANdb++ Editor |
| CAPL Browser | The code editor for CAPL. Compile, then start the measurement. | Separate editor window |
| Test module + report | Runs automatic test cases and shows pass / fail per step. | CANoe only (Test Setup) |
CAPL in 5 minutes
CAPL is "event-driven": your code waits for something to happen
| CAPL code | Meaning in simple words |
|---|---|
variables { int count = 0; } | Global variables: memory that all blocks share. |
on start { ... } | Runs once when you press Start. |
on message VehicleSpeed { ... } | Runs every time this message arrives. this = the message that arrived. |
this.VehicleSpeed | The raw value of the signal (e.g. 10000). |
this.VehicleSpeed.phys | The physical value (e.g. 100.00 km/h), raw × factor + offset. |
$OutsideTemp | Read the latest physical value of a signal. In CANoe you can also set it: $OutsideTemp = 4.9; |
msTimer t; setTimer(t, 500); + on timer t { ... } | Start a timer; after 500 ms the on timer block runs. |
message 0x123 m; m.byte(0) = 0xAB; output(m); | Build a message by hand and send it on the bus. |
write("Speed %.1f", x); | Print text in the Write window (%d whole number, %.1f 1 decimal, %X hex, %s text). |
testcase TC_1() { ... } + void MainTest() { TC_1(); } | Automatic test cases in a test module. MainTest decides the order. |
testStepPass("1", "..."); / testStepFail(...) | Write a passed / failed step into the test report. |
TestWaitForTimeout(1000); | In a test: wait 1 second (let the ECU react). |
CAPL looks like the C language: if, else, for, while, ; at the end of lines, { } around blocks. This mock understands a useful subset of CAPL, enough to learn.
The lab
Follow the lessons in the blue box. Each lesson tells you what to click. It turns green by itself when you have done it.
Rest-bus: turn messages on/off (simulate a broken ECU)
Requirements of this cluster (read them!)
- REQ-SPD-01: Show the vehicle speed, rounded to whole km/h. If no speed message for 500 ms, show "---".
- REQ-TMP-01: Show outside temperature with 1 decimal. If no message for 1.5 s or value SNA (0xFFFF), show "--.- °C" and no snowflake.
- REQ-TMP-02: Snowflake ON at 4.0 °C or below, OFF at 5.0 °C or above, no change in between (hysteresis).
- REQ-BLT-01: Seatbelt lamp ON when the driver is not buckled; FLASHING when speed is above 25 km/h.
- REQ-DOR-01: "Door open!" pop-up and DOOR lamp when a door is open.
- REQ-FUL-01: FUEL lamp when fuel is below 10 %.
- Everything is off when ignition (KL15) is not ON.
| Time (s) | Chn | ID | Name | Dir | DLC | Data (hex bytes) |
|---|---|---|---|---|---|---|
| Press ⚡ Start to see the messages on the bus. | ||||||
Interview questions about CANoe and CAPL
Q1What is the difference between CANoe and CANalyzer?
Short answer: "CANalyzer is for analysis: trace, graphics, logging, and sending frames with the Interactive Generator. CANoe can do all of that and also simulate ECUs that are missing (rest-bus simulation), has panels, and runs test modules for automated testing."
Q2What is rest-bus simulation, and why do we need it on an HMI bench?
Short answer: "On the bench, only the cluster or head unit is real. Rest-bus simulation means CANoe sends all the messages the other ECUs would send — ignition, speed, temperature — with the right cycle times, so the device behaves as if it were in a car."
Q3What do you see in the trace window?
Short answer: "Every message on the bus with its time stamp, channel, ID, name, direction (Tx/Rx), DLC and data bytes. When I expand a message, the DBC decodes the bytes into signals with physical values and units."
Q4How would you simulate a sensor failure in CANoe?
Short answer: "Three ways: stop sending the message (timeout), send the SNA or invalid value (like 0xFFFF), or send out-of-range values. Then I check the display shows the defined fallback, like '--.-', and recovers when the signal comes back."
Try it in the lab: lesson 6.
Q5What is CAPL? Which event procedures do you know?
Short answer: "CAPL is Vector's C-like, event-driven language in CANoe and CANalyzer. Main events: on start, on message, on timer, on key, on signal, and on stopMeasurement. Common functions: write, output, setTimer, and $Signal access."
Q6What is the difference between raw and physical values in CAPL?
Short answer: "this.Speed gives the raw value from the bytes. this.Speed.phys gives the physical value using the DBC factor and offset: raw × factor + offset. $Speed also gives the physical value."
Q7How do you automate a test in CANoe?
Short answer: "With a test module: I write test cases in CAPL (testcase), set input signals, wait with TestWaitForTimeout or wait for a message, check the ECU's response and report testStepPass or testStepFail. MainTest runs the test cases, and CANoe creates a test report with the verdict."
Try it in the lab: lesson 11.
Q8What is the Interactive Generator used for?
Short answer: "To send CAN frames by hand: I set the ID, DLC and data bytes and send once or cyclically. It's useful for quick checks, like sending one specific value or an invalid frame without writing a script."
Q9Have you used CANoe? (if you only practised)
Honest answer: "I haven't used a licensed CANoe in a project yet. I've practised the concepts with a simulator — trace analysis, decoding signals with the DBC, the Interactive Generator, panels, CAPL on message and on timer handlers, and a small test module with a BVA test. I understand the workflow and can pick up the real tool quickly."
Free ways to practise with real tools later
- python-can (free Python library) has a virtual bus: you can send and receive CAN messages on your PC without hardware. Together with cantools you can load a DBC file. See the Automation page for example scripts.
- BUSMASTER is a free, open-source CAN tool that looks similar to CANalyzer (trace, sending messages, simple scripting).
- On a Linux PC, SocketCAN with a virtual
vcan0interface and thecandump/cansendcommands lets you practise traces for free.