MATLAB Answers

Why do I receive a warning on bus-capable blocks + matlab function from r2017 and not before?

조회 수: 22(최근 30일)
deRicaud
deRicaud 2021년 6월 8일
답변: deRicaud 2021년 6월 15일
Hello,
I have an issue regarding the use of Bus combined with Matlab function.
What I want to do is the following:
  • use a matlab function block to treat a signal.
  • This matlab function outputs a bus (not a mux, because signals can be of differents data types)
  • this Bus is send to other buses in the model
The issue is the following: when I use the serach function (ctrl+f), I get the following warning in the command window:
Warning: 'untitled/test/Bus Selector Frame_1' must be connected to a Bus Creator, Bus Selector or a bus capable block.
A possible cause of this error is the use of a bus-capable block (such as Merge or Unit Delay) that in this current situation is
unable to propagate the bus downstream to the block reported in this error. Please see Simulink documentation for further
information on composite (i.e. bus) signals and their proper usage.
I did defined the bus in the properties of the subsystem (InitFcn and LoadFcn), and I did assigned the definition in the bus properties:
The bus signal is effectively defined in the workspace, and the model runs properly (also runs properly after code generation).
(FYI, I do have the same behaviour if I define the bus externally, from the command window, before model opening)
This warning is a big problem for me because I use this a lot of times in my model, and the search function takes 1 day because of this warnings instead of 15min... This behaviour is also observed with the used of function looking for backpropagation properties ending on this matlab function. Therefore using code generation tools, I get the same warning.
The temporary workaround I found is the deactivation of the warning, but I would like to solve the issue once and for all..
What I don't understand is that it is matlab version related: I do not have this issue in r2016b, but I have it using r2017a and r2020b.
You can find attached a model producing this issue.
Thanks for your anwers.

채택된 답변

deRicaud
deRicaud 2021년 6월 15일
If somebody has the same issue, Matlab will correct this in future release. There is apparently no workaround, except deactivating manually the warning with the following line:
warning('off','Simulink:blocks:BusSelectorUnconnected')

추가 답변(1개)

Jonas
Jonas 2021년 6월 8일
I get no warnings when running your model or searching objects.
Maybe it is related to the fact that you create the Bus object using a block callback function.
Why don't you create a Simulink.Bus object inside your Model Workspace or a linked Data Dictionary to define the structure and its elements there, and then use the Bus object as the data type for the output of the MATLAB function. I am guessing it will avoid the warning you get because the Bus object will be findable at any stage.
  댓글 수: 5
deRicaud
deRicaud 2021년 6월 9일
Ha sorry, I forgot to mention that the warning is in the command window. So as you can see it is not much of a problem in this example, but when you multiply this by the number of recursion I have in my model, you end up with a long time for warning displaying, and a command window that grows to hundreds of thousands lines...

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by