How can I input a vector in a control port of a switch when "Allow different data input sizes[...]" is active?

Error Message when I try it:
When the "Allow different data input sizes (Results in variable-size output signal)" parameter is selected for 'test/Switch', the input signal to the control port and the threshold value must both be scalars.
I attached a picture of a testcase that shows an example of the model I want to run. The simulation runs 3 equidistant timesteps ( t = [0 1 2] )
Whe the multiport switch is also set to "Allow different data input sizes (Results in variable-size output signal)" I get another error:
Simulink cannot propagate the variable-size mode from the output port 1 of 'test/Multiport Switch' to the input port 2 of 'test/Switch1'. This input port expects a fixed-size mode. Examine the configuration of 'test/Switch1' for one of the following scenarios: 1) the block does not support variable-size signals; 2) the block supports variable-size signals but needs to be configured for them.
But "Allow different data input sizes (Results in variable-size output signal)" is active for test/switch1, so why doesn't it work?

3 件のコメント

Swarooph
Swarooph 2017 年 7 月 31 日
Looks like from your first error, the control port (2nd input) only accepts scalars no matter what. The variable size property is only for the 1st and the 3rd inputs it seems.
Pascal Knappe
Pascal Knappe 2017 年 8 月 1 日
That's right, because this is what the error message says. But is there a way to get a model running as it is intended by me? Is there an alternative for variable input size?
Swarooph
Swarooph 2017 年 8 月 1 日
Can you give us an example of what the expected output of Switch1 is with an example input to it? I have a feeling this might be possible without a Switch block.

サインインしてコメントする。

回答 (1 件)

Saurabh Gupta
Saurabh Gupta 2017 年 8 月 2 日
Adding to Swaroop's points, I think the crux of the errors is this message: "Simulink cannot propagate the variable-size mode from the output port 1 of 'test/Multiport Switch' to the input port 2 of 'test/Switch1'. This input port expects a fixed-size mode."
When you enable "Allow different data input sizes (Results in variable-size output signal)" on 'test/Switch1', it applies to the data input ports and not to the control signal. The control signal need to be fixed sized.
One simple workaround is to modify Constant2 and make it 1x5. If that doesn't work for your use-case, then a redesign may be required to ensure that 'test/Switch1' receives a fixed size control signal.

カテゴリ

ヘルプ センター および File ExchangeEvent Functions についてさらに検索

製品

質問済み:

2017 年 7 月 31 日

回答済み:

2017 年 8 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by