CanTool shows zero for physical value
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
As a master student Automotive Engineering Science, i'm investigating the Vehicle Network Toolbox which i'm going to use for a project.
The Vehicle Network Toolbox Simulink demos are working fine, however I am experiencing a problem using the canTool for viewing live CAN message data:
I simulate a CAN message using the 'CAN Pack'-block, attaching a *.dbc database file to it, and transmit it via a Virtual Channel (using the 'CAN Transmit'-block). The Min and Max value of the signals in the database are correctly indicated in the 'CAN Pack'-block as -Inf and Inf (infinite). (Although in the *.dbc database these values are both indicated as zero, because only numerical values can be used).
The problem is that when I visualize the data send on this Virtual Channel using the canTool, all signals in the signal show a Physical Value of zero, whereas the raw data indicates that there is a non-zero signal.
However, if I change the default values of the minimum and maximum value of the signal in the database file to a non-infinite number (for example -1000 and 1000), the canTool correctly show the Physical Values which are non-zero for the signals in the message.
Since I am completely new with the Vehicle Network Toolbox, I may have overlooked something, but at this point I cannot figure out what.
Could someone please tell me if (and how) this problem can be solved?
Since the database file which I have to use eventually, contains more than 250 message- and signal-data, I'm not eager to change all the maximum and minimum values (which are all set to infinite).
Thanks in advance,
Joost
P.S. I'm using Matlab version 2010b and Vehicle Network Toolbox version 1.3
0 comentarios
Respuesta aceptada
Shankar Subramanian
el 11 de Mayo de 2011
You can create a channel in MATLAB, start it to receive the messages on the network.
% Create Channel - Virtual Channel 2
% (Assuming Simulink is sending on Channel 1)
canch = canChannel('Vector', Virtual 1', 2);
% Set CAN channel online
start(canch)
Once online, the CAN channel canch is set to send and receive messages. You can see the number of messages received so far by typing canch in command line.
canch
canch =
Summary of CAN Channel using 'Vector' 'Virtual 1' Channel 2.
Channel Parameters: Bus Speed is 500000.
Bus Status is 'ErrorActive'.
Transceiver name is ''.
Serial Number of this device is 0.
Initialization access is allowed.
No database is attached.
Status: Online.
18 messages available to receive.
0 messages transmitted since last start.
0 messages received since last start.
Filter History: Standard ID Filter: Allow All | Extended ID Filter: Allow All
You can use the receive command to receive your messages.
% Receive all messages.
msgs = receive(canch, Inf);
% Attach database.
database = canDatabase('DATABASENAME.dbc');
attachDatabase(msgs, database);
You can save the received messsages to a MAT-file using the save command so that you can analyze them later.
Additionally, you can set filters in your channel to receive specific message IDs. You can find other available CAN functions in the following page.
HTH,
Shankar
Más respuestas (3)
Arnaud Miege
el 10 de Mayo de 2011
I think the problem is because the min/max values are specified as zero in the database, which is interpreted as the signal having a max value of zero and also a min value of zero, therefore being equal to zero. At least, that's how I understand it.
If you can't specify +/-Inf in the database (I'm not that familiar with CAN databases), then you'd have specify a finite value. This can probably be automated with MATLAB, rather than having to do it by hand, but I'm not too sure how to go about it.
HTH,
Arnaud
0 comentarios
Shankar Subramanian
el 10 de Mayo de 2011
Yes, your understanding is correct that the min/max values of 0 is causing the physical values of signals to be shown as 0. At this point you will have to update the min/max for the signals in CANdb++ editor.
On the other side - what does your application do? If you want to use Simulink and you want to log signal values, you can extract them using CAN unpack block and save the signal values using To Workspace or To File block. In this case, you may not need to update the DB file as the min/max used in Simulink is -Inf/Inf. If you want to do post analysis in MATLAB you can load the saved variables/file in command line.
HTH,
Shankar
0 comentarios
Ver también
Categorías
Más información sobre Vehicle Network Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!