CANoe.Car2x Scenario API - Straightforward Connection of External Simulation Environments
When testing V2X-based assistance systems, the generation of sometimes quite complex traffic scenarios plays a decisive role. Simulation tools are used to simulate realistic traffic scenarios and driving tests in virtual environments.
However, these simulation tools, such as DYNA4 from Vector or CarMaker, do not support V2X communication. They describe the scenarios and the events that occur within them, such as a braking maneuver, in a general and abstract way.
Engineers are therefore faced with the challenge of generating V2X communication from the data provided by these simulation tools, such as GNSS positions or hazardous situations and events that occur. In order for the V2X communication to be received and interpreted correctly by the ECUs, it must comply with the relevant standards and specifications.
This is where CANoe.Car2x comes into play. Using the powerful Scenario API programming interface, data from external simulation tools is received in CANoe and standardized V2X messages are generated from it. The ECU under test is then stimulated based on these generated messages.
Dynamically Simulating V2X Vehicles - an Example Application
CANoe can read data from external simulation tools via a variety of interfaces such as UDP or FDX and easily process it with the Scenario API.
In the following example, the GNSS positions of a simulated vehicle from an external traffic scenario are transferred to CANoe.Car2x via a UDP interface. The CAPL (Communication Access Programming Language) programming environment from CANoe is used to receive the position data as well as the orientation and speed of the vehicles from the external simulation environment. The CreateStation function of the Scenario API generates a simulated vehicle when the measurement is started in CANoe. If the external data changes, the C2xSetStationBaseAttributes function updates the data of the simulated vehicle.
This generates the V2X communication, such as the sending of CAM messages, for the vehicle based on the currently transmitted data. CANoe's V2X stack ensures that these are sent according to the standards.
on start
{
// Create simulated stations via the Scenario API
C2xCreateStation("SimulatedStation_1");
C2xCreateStation("SimulatedStation_2”);
...
}
// Callback when external data is received
void OnReceiveUdpDataFromExternalEnv()
{
// Received gnss data from external simulation
// (e.g. UDP Socket or FDX communication)
// and copy data to struct SimVehicl
}
void SetDataToSimulatedStation()
{
C2xSetStationBaseAttributes("SimulatedStation_1",
SimVehicle::GNSSData.latitude,
SimVehicle::GNSSData.longitude,
SimVehicle::GNSSData.elevation,
SimVehicle::GNSSData.heading,
SimVehicle::GNSSData.speed);
}
CANoe.Car2x Uses Existing Simulation and Test Environments
With the dynamic scenario API of CANoe.Car2x, any simulation tools can be connected to CANoe. Consequently, existing simulation and test environments can continue to be used, as CANoe.Car2x takes care of generating the V2X communication.