Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

for an example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top