How to generate signal possible values from dbc as a generic output with CAPL

2.6k Views Asked by At

I am using Canoe version 10.0 and I wanted to ask if there is a smart way to generate the optional signal's value from the database to other value.

Right now I am doing it hard coded but it's getting annoying doing so for each signal. Especially when I know the database holding information such as signal length,start bit,and min&max possible value.

I saw that there are options such as getSignal,setSignal, etc.. but I didn't manage to understand how to use them properly in order to achieve my goal.

Thanks for the help.

2

There are 2 best solutions below

0
On

Short: No, you cannot access symbolic values from CAPL for a given signal described in a dbc/fibex database. So you cannot make a call like :

 SetSignal (SignalnamefromDbc, SNA_VALUE); /*SNA_VALUE defined in dbcis 7*/

There are several workarounds, but I need more information about what your simulation can, and cannot do.

For example: OEMs along with Vector, usually write specific dll libraries to generate realistic signal values, without your specific request. These dlls are usually linked to the Simulation Node ,and can be activated/disturbed/halted any time during simulation.

0
On

I know it has been a long time, but my understanding is the following.

Especially when I know the database holding information such as signal length,start bit,and min&max possible value.

Usually the database is defined in 2 files:

  • The DBC (format from VECTOR) which defines the signals, name, bit start, length, etc
  • An EXCEL file which defines the frames periodicity and signals default values

You can input the DBC files directly into CANoe/CANalyser and CAPL will be able to directly access the signals values.

on message ABSdata // <== frame name as defined in the DBC file
{
  if (this.DIR == RX) 
  {
    // CarSpeed is a signal belonging to the frame ABSdata
    write("The signal value of car speed is %d", this.CarSpeed);
  }
}

There is no need to write any complicated function to extract the value of a signal. CANoe/CANalyser will do the proper decoding if you provide a proper DBC file.