SIMULINK testing a model that has bus input and output ports

조회 수: 30 (최근 30일)
Mohammed Manna
Mohammed Manna 2013년 12월 3일
답변: Mark McBroom 2024년 5월 31일
I have a SIMULINK model that uses bus inputs and outputs as top level ports. When I am testing it, I don't know how to create a test signal as a bus and feed it into the model. I know that the straightforward way to do it is to create lots of individual signal and use bus creator block to group those as a bus that will feed into the model. However, this may not be a very efficient way to do things. Does anyone know any alternative?
I tried to look into Mathworks website but nothing really came up. Any help would be appreciated
  댓글 수: 2
Mohammed Manna
Mohammed Manna 2014년 1월 13일
Thanks. i have already found the solution, it was basically an array of buses and all the leaf bus and element names needed to be EXACTLY the same in my input signal structure (a bit weird)

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

답변 (2개)

Jens
Jens 2014년 1월 13일
TPT is a very efficient testing and verification tool for Simulink models. It handles busses as well as vector signals automatically. The test harness for the Simulink model can be build automatically. So it is very efficent. TPT

Mark McBroom
Mark McBroom 2024년 5월 31일
If you already have a Simulink.Bus defined, another approach is to place a constant block in the Simulink model, set its value to zero, and set the data type to be the Simulink Bus. You can connect the output of the constant block to a Bus Assignment block to override any signals that you want to have non-zero values.
The createMATLABStruct function can also be useful if you have a Simulink.Bus. This function creates a MATLAB structure with the same layout as the Bus. You can then populate individual fields with the desired value, and then use this MATLAB struct in a Simulink Constant block to generate a bus signal. Create MATLAB structures that use the same hierarchy and attributes as buses - MATLAB Simulink.Bus.createMATLABStruct (mathworks.com)
Thanks.
Mark.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by