Is it possible to pass a CAN_MESSAGE to a Simulink Referenced Model using MATLAB R2023a?

1 次查看(过去 30 天)
Hello,
Is it possible to pass a CAN_MESSAGE to a referenced subsystem? I got an error if I have a CAN Unpack inside a Refenced Model and a CAN pack outside.
Error in default port data type function of S-function 'TargetModelController/CAN Unpack'. This function does not set the data type of 'Input Port 1'
I am still struggeling with the same question asked in 2019 regarding R2012a:
Any updates on that topic?

回答(1 个)

Yatharth
Yatharth 2024-2-22
Hi Martin,
I understand you're attempting to pass a CAN_MESSAGE to a referenced subsystem. It appears there is a discrepancy between the error messages you've mentioned in your post and those in the MATLAB Answer link you provided. The error message indicates that the problem might be with the CAN Unpack block.
To address your issue, you should set the data type of the output port. You can achieve this by using the ssSetOutputPortDataType function. Here is the documentation link for reference: https://www.mathworks.com/help/simulink/sfg/sssetoutputportdatatype.html
Additionally, you might find it beneficial to review this example of creating custom CAN Blocks, which could provide further insights into resolving your issue. https://www.mathworks.com/help/vnt/ug/create-custom-can-blocks.html
I hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by