MATLAB Answers

Vehicle data acquisition simulation using Vehicle Network Toolbox in Simulink

6 views (last 30 days)
Shreya Agrawal
Shreya Agrawal on 6 Oct 2020 at 17:57
I have created a sensor data acquisition model on simulink using Vehicle network toolbox blocks. I have used a used defined function block for converting the int8 data coming form SARADC block into an unsigned 8 bit vector such that I can feed the same to CAN PACK block for transmssion. The matlab code used in user-defined function block for conversion is attached. The same error showed up when I put a Bus to vector converter in the path between user defined function block and CAN pack block.
The error shown was-
Inferred size ('[1 8]') for data 'y' does not match back propagated size ('scalar') from Simulink.
Simulink cannot determine sizes and/or types of the outputs for block 'ADC_CANmodel/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Another thing I tried was putting an integrated matlab function block between ADC and CAN pack block, giving the same converter function to it and setting output dimension of block to be 8 and MATLAB function as converter function file name.
This showed an error-
Invalid input signal width, data type or input port is not connected. The data type of input signal must be UINT8 with a maximum signal width of 8.
An error occurred while propagating data type 'double' from 'ADC_CANmodel/Interpreted MATLAB Function', output port 1.
Please help me where am I going wrong. Please help as soon as possible.


Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!