CAPL Script

CAPL Examples

Start with a task you can reproduce in your own CANoe configuration. The links below lead to published walkthroughs; they are not a promise that every example works unchanged with every tool version or database.

Choose a walkthrough

Task Walkthrough What to check before running
Separate missing observations from rejected payloads CAN message filtering and evidence Keep channel, identifier format, direction and frame type consistent; record why a payload was rejected
Read or export a text file reliably CAPL file I/O validation Verify the actual path, open mode, return status, buffer boundary and resource cleanup
Inspect message timing CAN message timestamp update The channel, message ID and timestamp units used by your version
Analyze an exported timing sequence Message interval analyzer Export one filtered stream as a timestamp list; select the timestamp unit and a requirement-based target
React to a CAN message Core interaction with the bus The database mapping, payload length and event-handler context
Model a door module Develop a simulation node The command/status messages, initial state and timer behavior
Check a simulated ECU automatically Test module development Test-module support, available test functions and failure/timeout handling
Connect simulation and tests Comprehensive project The complete configuration and the relationship between simulated nodes and tests

Adapt one behavior at a time

First compile the example in the intended node or test-module context. Replace database names and message IDs with those from your own test setup. Inspect the Trace and Write windows to verify what is actually sent or received before adding more behavior.

A test that waits for a response also needs a failure case: run it once with the simulated responder disabled and confirm that it times out rather than reporting success. For cyclic traffic, check several consecutive timestamps and confirm that the period has the expected units. For signal values, check both the raw payload and the database-scaled value.

These pages are educational material, not evidence of validation on a live vehicle. Read the technical disclaimer. If a sample fails, send the page URL, tool version and compiler message through Contact & corrections.