SOME/IP with CANoe Communication Setup
Part 4. Simulation with CAPL Programming
Version 1.0, July 18, 2023
Agenda
Overview
Application Model (CAPL)
Technical References
Overview
This document is for users who want to:
- Implement logic of SOME/IP application via CAPL Programming.
- Understand the Initial Setup, including:
- SOME/IP concept in CANoe
- Import Data Sources
- Import Application Models
- Write Data Source as a vCDL
- Simulation with CANoe GUI features
- Analysis of SOME/IP data
- Simulation with CAPL programming
The CANoe sample configuration is prepared for your understanding. You can access it at: https://portal.vector.com/shared/068f1303-77de-4eab-8bd0-ca37938c6885
This serves as a quick start guide for basic SOME/IP simulation and analysis. For extended knowledge, refer to the CANoe Help Manual, which covers more detailed technical information.
Application Model (CAPL)
Basic CAPL Applications
Value Access
Use the '$' sign for accessing communication values.
'Write Value'
This can trigger Event and Field Notification:
$CommunicationObjects::Calculator.providerSide[Provider].State.AddCount = gAddCount;
$CommunicationObjects::Calculator.providerSide[Provider].State.SubtractCount = gMultiplyCount;
$CommunicationObjects::Calculator.providerSide[Provider].State.MultiplyCount = gMultiplyCount;
$CommunicationObjects::Calculator.providerSide[Provider].State.DivideCount = gDivideCount;
'Read Value'
write("State event received. AddCount: %d, SubtractCount: %d, MultiplyCount: %d, DivideCount: %d",
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.AddCount,
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.SubtractCount,
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.MultiplyCount,
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.DivideCount);
Request Call
Use the CallAsync(params..)
function for calling Method and Field Getter/Setter.
'Method Call'
Example: Call method 'Add' of service 'Calculator' when key 'c' is pressed:
// Call method 'Add' of service 'Calculator' when key 'c' is pressed
CommunicationObjects::Calculator.Add.CallAsync(3,6);
'Field Getter/Setter'
Example: Call Field Getter 'CalcResult' of service 'Calculator' when key 'g' is pressed:
// Call Field Getter 'CalcResult' of service 'Calculator' when key 'g' is pressed
CommunicationObjects::Calculator.CalcResult.Get.CallAsync();
Example: Set CalcResult to '0' when key 's' is pressed:
// Call Field Setter 'CalcResult' of service 'Calculator' when key 's' is pressed
CommunicationObjects::Calculator.CalcResult.Set.CallAsync(0);
The number and data type of input parameters follow the prototype defined by the Data Source (vCDL).
Event Handler
on fct_called
/ on fct_returned
are called when Method and Field Getter/Setter are processed.
Provider side - on fct_called
Called when receiving the request from a consumer:
// Implementation for method 'Add'
on fct_called CommunicationObjects::Calculator.Add
{
this.result = this.operand1 + this.operand2; // Calculate result
gAddCount++; // Update counter
this.ReturnCall(); // Return result
}
Consumer side - on fct_returned
Called when receiving the response from a provider:
// This handler is called when the return value of method 'Add' of service 'Calculator' is received
on fct_returned CommunicationObjects::Calculator.Add
{
// Print result in the Write Window of CANoe
write("Result of Add method: %f", this.result);
}
on value_change
Called when the value of an Event / Field Notification changes.
Example: Handler for the 'State' event:
// This handler is called when the value of the event 'State' changed
on value_change CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State
{
write("State event received. AddCount: %d, SubtractCount: %d, MultiplyCount: %d, DivideCount: %d",
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.AddCount,
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.SubtractCount,
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.MultiplyCount,
$CommunicationObjects::Calculator.consumerSide[Consumer, Provider].State.DivideCount);
}
on value_update
Called when the value of an Event / Field Notification is updated.
CAPL Practice
Application Logics Example
The following diagram illustrates the interaction between a consumer and a provider using CANoe:
Consumer.can:
- Call Method 'Four arithmetic'
- On Method Returned 'Four arithmetic'
- On Value Change Event 'State'
- Call Field Getter / Setter 'CalcResult'
Provider.can:
- On Method Called 'Four arithmetic' (Operation Add, Subtract, Multiply, Divide)
- Return Call
- Trigger Event 'State'
- Trigger Field Notification 'CalcResult'
The communication is established via SOME/IP over Ethernet, with a binding block configured.
Scenario 'Method Call'
Consumer.can:
- Call Method 'Add' with parameters 3 and 6.
Provider.can:
- Implementation for method 'Add': Calculates the sum of operands, increments a counter, and returns the result.
Consumer.can:
- On Method Returned 'Add': Receives the result and prints it to the CANoe Write Window.
This process involves dragging and dropping elements from the Symbols Window.
Scenario 'Event' Trigger
Provider.can:
- Trigger Event 'State': Updates the state variables (AddCount, SubtractCount, MultiplyCount, DivideCount) and triggers a notification.
Consumer.can:
- On Value Change Event 'State': Receives the updated state values and prints them to the CANoe Write Window.
This scenario also utilizes drag and drop functionality from the Symbols Window.
Scenario 'Field Notification' and 'Field Getter and Setter'
Consumer.can:
- Call Field Getter: Triggered by key 'g', calls the 'CalcResult' getter.
- Call Field Setter: Triggered by key 's', calls the 'CalcResult' setter with a value of 0.
Provider.can:
- Field value update and Notification: Updates the 'CalcResult' field, which also triggers the transmission of the field notification.
This involves drag and drop operations from the Symbols Window.
Technical References
Video Recording
Introduction to Automotive Ethernet
Topics covered:
- Introduction to Ethernet- and IP-based communication
- Physical layers: IEEE 10BASE-T1S, 100BASE-T1, 1000BASE-T1, 100BASE-TX and Multi-Gig
- Overview of used communication protocols: IP, TCP, and UDP
- DoIP: Diagnostics over IP
- SOME/IP: Scalable service-Oriented Middleware over IP
CANoe for Service-Oriented Architectures(SOA) - Part1. SOA Fundamental
Link: https://youtu.be/M_SXOgci1p4
This video covers Service-Orientation in E/E Designs.
Calculator Example
CANoe configuration, vCDL, Analysis Features, Simulation Features, CAPL Codes
Download Sample Configuration: https://portal.vector.com/shared/068f1303-77de-4eab-8bd0-ca37938c6885
The CANoe interface displays various configurations including communication setup, simulation panels, trace windows, and event/field data. It shows the interaction between consumer and provider for methods like 'Add' and events like 'State', as well as field updates for 'CalcResult'. The trace window logs SOME/IP messages and Service Discovery information.
CANoe Help Manual
CANoe Communication Concept Overview
CANoe provides a uniform and cross-network communication concept for simulation and testing, enabling application-related modeling of communication patterns. It decouples logical communication from network protocols, offering a network-independent interface for application models and test scripts.
Concept:
- Basics of the Communication Concept
- Service-Oriented Communication
- Binding
Application Layer Objects:
- Communication Objects
- Distributed Objects
- Display and Stimulate Application Layer Objects
Configuration:
- Communication Setup
- Load Data Source
- AUTOSAR Preprocessor
- CANoe AUTOSAR Converter
Binding:
- Abstract Binding
- SOME/IP Binding
- MQTT Binding
- HTTP Binding
- DDS Binding
- IoT Enabler
- Mapping
Programming:
- Programming C#, Python and CAPL
- Vector Communication Description Language (vCDL)
CAPL Programming Overview
This section details how to use objects and APIs in C# or CAPL for application modeling and testing. It covers:
- Introductory Examples in C# and CAPL
- Accessing values of distributed objects / communication objects
- Calling and implementing functions
- APIs for different types of communication objects
- Endpoint selection
- CAPL/C# Data Types
- Service Discovery APIs and models
- CAPL Functions for COs
- Data types for distributed objects (CAPL, Python and C#)
- Creating dynamic objects
- Using interfaces of distributed objects
- Attributes, Members, and Methods
- CAPL Functions for DOs
Related Documents
![]() |
CANoe .Ethernet: Automotive Ethernet Network Simulation and Analysis Product information for Vector's CANoe .Ethernet option, detailing its capabilities for simulating, testing, and analyzing automotive Ethernet networks, including support for protocols like SOME/IP, DoIP, and hardware like the VN5600 series. |
![]() |
Vector CANoe/CANalyzer 12.0 New Features Webinar An overview of the new features and improvements in Vector's CANoe and CANalyzer software, version 12.0, presented in a webinar. Covers communication concepts, Ethernet, testing, VT System, new options, Car2x, and additional protocols. |
![]() |
CANoe/CANalyzer New Features Version 14 | Vector Explore the new features and enhancements in Vector's CANoe and CANalyzer Version 14, including updates to CANoe4SW, CANoe4Server, SOA, Ethernet, LIN, Car2x, and discontinued hardware support. |
![]() |
CANoe 12.0 and CANalyzer 12.0 Feature Matrix A comprehensive feature matrix detailing the capabilities of Vector's CANoe 12.0 and CANalyzer 12.0 automotive software tools, covering various bus systems, analysis functions, simulation capabilities, and system requirements. |
![]() |
Vector CANoe Option DDS: Simulate and Test DDS Applications Efficiently Vector expands its CANoe development and test environment with the new CANoe Option DDS, enabling users to simulate, analyze, and test DDS-based systems efficiently. Ideal for automotive, medical technology, and Industry 4.0 sectors. |
![]() |
CANoe Product Information: Development, Testing, and Analysis Tool Explore CANoe, a versatile tool for automotive network development, testing, and analysis. Learn about its functions, system requirements, and options for ECU development. |
![]() |
CANoe 14 and CANalyzer 14 Feature Matrix A comprehensive feature matrix comparing CANoe 14 and CANalyzer 14, detailing supported network systems, description formats, variants, and functionalities for automotive software development and testing. |
![]() |
Vector CANalyzer: Comprehensive Automotive Network Analysis Tool Vector CANalyzer is a powerful software tool for analyzing, stimulating, and diagnosing automotive networks such as CAN, LIN, FlexRay, and Ethernet. This document provides an overview of its features, functions, interfaces, and options, including detailed explanations of its analysis windows, programming capabilities with CAPL, diagnostic functions, and hardware compatibility. It is designed for automotive engineers and developers working with in-vehicle communication systems. |