Borrar filtros
Borrar filtros

Code generation with VNT in release mode

2 visualizaciones (últimos 30 días)
Dan
Dan el 26 de Abr. de 2024
Respondida: Amish el 30 de Mayo de 2024
Hi,
I am encountering an issue when I use the embedded coder with the vehicle-network-toolbox and build in release mode. When built in release mode the generated code does not seem to actually pack any CAN messages. When built in debug mode everything works as expected.
We are using the CAN PACK and CAN UNPACK functions with a .dbc file to specify the messages. We specify the message data as a bus, which we are transferring to/from our CAN driver using hand written C++ code (not using the simulink CAN Transmit / CAN Receive blocks).

Respuestas (1)

Amish
Amish el 30 de Mayo de 2024
Hi Dan,
It seems like you are experiencing issues with data integrity and continuity while attempting to stream EMG signals from a system to Simulink via TCP/IP.
This can be due to several factors, I would suggest you to try the following steps for troubleshooting:
  • Check the Network stability and ensure that the system and the computer running Simulink is stable and fast enough to handle the data throughput.
  • Verify that the sample rate and data format (e.g., float, integer) expected by your Simulink model match the output of your system. Mismatches here can lead to distorted signals.
  • Validate the integrity of the data stream outside of Simulink. You can write a simple MATLAB script that connects to your system via TCP/IP and logs the incoming data to a file or plots it in real-time. You can use a script as follows:
% Example MATLAB script to test the TCP/IP data stream
t = tcpip('192.168.1.1', 5000, 'NetworkRole', 'client'); % Change IP and port to your values
fopen(t);
data = [];
for i = 1:1000 % Adjust loop for adequate sampling
if t.BytesAvailable > 0
rawData = fread(t, t.BytesAvailable);
data = [data; rawData];
% Optionally, you can process/plot rawData here
end
end
fclose(t);
delete(t);
clear t;
Additionally, you may try adding error handling to your model to manage cases where data packets are lost or arrive out of order.
Hope this helps!

Categorías

Más información sobre Vehicle Network Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by