Syntax
set_param_dbc(b,dbcfilename,bo,dir,ioboardtype,boardno,netno,canidformat,importcompatname,splitlongsignals)
Description
set_param_dbc configures the specified instance of the DBC CAN
block.
Assumptions:
- No other DBC CAN blocks are open when this function is called.
- The model containing block
b
is loaded in MATLAB.
Arguments
b
- Block name, specified as a string as returned by the
gcb
command.
dbcfilename
- Full path and file name of the .dbc file.
bo
- Message information, specified as one of the following:
- Number, specifying the message ID as a decimal number
- String, specifying the message name
dir
- RTDB variable direction, specified as one of the following:
ioboardtype
- I/O board type, specified as one of the following:
boardno
- Board number, specified as an integer in the [1,4] range.
netno
- Net number, specified as an integer in the [0,3] range.
canidformat
- Flag indicating the CAN ID format, specified as one of the following:
- 1 - Decimal
Can also be specified using the enumeration:
simwb.constants.dbc.canid_dec
- 2 - Hexadecimal
Can also be specified using the enumeration:
simwb.constants.dbc.canid_hex
importcompatname
- Flag indicating whether the RTDB variable name should follow the
pattern used by the DBC Import I/O device in the Control Center. Specified
as one of the following:
- 0 - RTDB variable name format is:
b<BOARDNUM>_n<NETNUM>.id_<CANID>.<SIGNALNAME>
Can also be specified using the enumeration:
simwb.constants.dbc.importcompatname_exclude_txrx
- 1 - RTDB variable name format is:
- Output -
<TXECU>_<SIGNAL_NAME>_<CANID>_<POINT_TYPE>
- Input -
<sigECUList[rxecucount]><SIGNAL_NAME><CANID><POINT_TYPE>
Can also be specified using the enumeration:
simwb.constants.dbc.importcompatname_include_txrx
splitlongsignals
- Flag indicating whether signals that are longer than 32-bits must be
split into 1-byte sub-signals, specified as one of the following:
- 0 - Do not split signals longer than 32-bits
- 1 - Split signals longer than 32-bits into 1-byte sub-signals.
Signals must satisfy the following criteria to be split:
- Number of bits is greater than 32
- Number of bits modulo 8 is 0
- Signal gain is 1
- Signal offset is 0
Example:
load_system('simwbCustomBlocklib');
% m is the name of the model
open_system(m)
b = sprintf('%s/my_blk',m);
add_block('simwbCustomBlocklib/DBC_CAN',b)
dbcfilename = fullfile(pwd,'my_dbc.dbc');
bo_id = 42;
dir = 1;
ioboardtype = 1;
boardno = 1;
netno = 2;
canidformat = 2;
importcompatname = 0;
splitlongsignals = 0;
set_param_dbc(b,dbcfilename,bo_id,dir,ioboardtype,boardno,netno,canidformat,importcompatname,splitlongsignals);
See also: