how to define the output of a system object as a bus element in simulink?

조회 수: 15 (최근 30일)
dale finney
dale finney 2024년 4월 11일
댓글: Manikanta Aditya 2024년 4월 17일
I am using matlab system objects (SysOb) in simulink. I want to have the outputs assigned to a bus element. I can do this with a Subsystem and want the same behaviour for a SysOb. I tried creating an output struct for the SysOb but when I connect this output to a bus selector there are no signals (fields?) to pick. I assume that the SysOb should be at least as good as a Subsystem.
  댓글 수: 3
dale finney
dale finney 2024년 4월 11일
did you just google my question? if so, not helpful
I read item 1 and did not find anything specific to my problem
I had already tried item 2 but it doesn't work for me. This works when one assigns signals to a bus creator and then to an output bus element inside a subsystem. As I mentioned in my original question, subsystems are not a problem.
Manikanta Aditya
Manikanta Aditya 2024년 4월 17일
Oh Alright, I just shared the references hoping they can guide you to some extent.

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

답변 (2개)

Mark McBroom
Mark McBroom 2024년 4월 16일
  1. create a Simulink Bus with the same layout as the MATLAB structure you are creating in your system object.
  2. Set the type of the system object output to be this simulink bus using the getOutputDataTypeImpl() method:

dale finney
dale finney 2024년 4월 16일
thanks for your reply.
For Item 2 I have the something like following but with many more fields:
function out = getOutputDataTypeImpl(obj)
[out.A, out.B, out.C, out.D] = deal("logical");
end
For item 1, I still don't understand. I have to 'layout' the bus selector before I use it? normally simulink will populate the list of available signals in the bus. Is it different?

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by