SIMULINK use signal that will act as a bus input

1.1k views Asked by At

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

There are 2 answers

0
remus On BEST ANSWER

If your test signal is constant the easiest way is to add a Simulink Constant block and define the variable as a structure in some script .m file:

testSignal.a = 10;
testSignal.b = 20;
etc

Double-click on the Constant block, add the variable and then switch to the Signal Attributes tab where you specify the data type to match your bus signal definition.

1
Phil Goddard On

You need to define the data using Timeseries objects. See Import Structure of timeseries Objects for Buses

for an example.