How can I feed a variable-size signal generated by CFAR block to a multiport switch in Simulink?

3 views (last 30 days)
Hi, I'm currently doing a project on radar using Simulink but I got some issues when running simulation. My program has 5 CFAR blocks (provided in Phase Array System Toolbox) distributed respectively in 5 If Action Subsystem, and I'd like to merge their output signals together.
Since the output of CFAR block seems to be a variable-size signal and the Merge block doesn't support propagating that kind of signals, I used a Multiport Switch block which, from my understanding, the documentation suggests to be okay (see Variable-Size Signal Basics - MATLAB & Simulink ( However, even I've set the parameter 'Allow different data input sizes' correctly, I still got the error.
The error message from Diagonstics window is shown as below:
Error:Simulink cannot propagate the variable-size mode from the 'Output Port 1' of 'VICFAR/CFAR Behavioural Model/VI CFAR System/CFAR Method Selector/CA_CFAR-WinAVar' to the 'Input Port 4' of 'VICFAR/CFAR Behavioural Model/VI CFAR System/CFAR Method Selector/Multiport Switch'. This input port expects a fixed-size mode. The variable-size mode originates from 'VICFAR/CFAR Behavioural Model/VI CFAR System/CFAR Method Selector/CA_CFAR-WinAVar/CFAR Detector'. Examine the configurations of 'VICFAR/CFAR Behavioural Model/VI CFAR System/CFAR Method Selector/Multiport Switch' 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.
In the above paragragh, 'Output Port 1' of 'VICFAR/CFAR Behavioural Model/VI CFAR System/CFAR Method Selector/CA_CFAR-WinAVar' is simply the detection output of the CFAR block (data type supposed to be boolean) and 'Input Port 4' of 'VICFAR/CFAR Behavioural Model/VI CFAR System/CFAR Method Selector/Multiport Switch' is one of the input ports of Multiport Switch block.
I'm wondering why the Switch block could not accept variable-size signals in this case. Could someone give me some advices on resolving this issues? Millions of thank!

Answers (1)

Abhimenyu on 11 Feb 2024
From the information shared by you, I could infer that you’re encountering an issue with variable-size signals in your Simulink project involving "CFAR blocks" and a "Multiport Switch". The error message indicates that Simulink is having trouble propagating the variable-size signal from the "CFAR block" to the "Multiport Switch" block.
A variable-size signal in Simulink can change its size during model execution. The number of dimensions remains constant, but the number of elements in each dimension can vary. Many Simulink blocks are compatible with variable-size signals like "Switch" or "Multi-switch" blocks, "Selector blocks with indexing options", "S-function" blocks etc.
To handle variable-size signals in Simulink, please ensure that every block that deals with such signals is capable of handling them and is properly configured.
Follow the below mentioned steps to address the issue:
  • Block Configuration: Ensure that the "Multiport Switch" block is configured correctly to variable-size signals. Setting the "Output minimum" and "Output maximum" for configuration will help to avoid compatibility errors. After selecting the parameter "Allow different data input sizes", click on "Apply" button for the block to accept the variable-size signals.
  • Signal Attributes: Double-check the signal attributes (data type, sample time, dimensions) of the output of the "CFAR blocks" to ensure they are consistent and expected for variable-size signals. All input signals should be of the same type and complexity.
  • Subsystem Configuration: If you are using "If Action" Subsystems, make sure that the subsystems are configured to output variable-size signals correctly. Please use an "Enabled" Subsystem with the "States when enabling" parameter set to "held" to maintain the signal dimensions when the subsystem is not active.
  • Simulation Settings: Review the simulation settings to ensure that they are compatible with variable-size signals. For example, check the solver configuration and the sample times being used.
  • Update Diagram: Sometimes, forcing an update of the Simulink diagram can resolve issues with signal dimensions. Use the "Ctrl+D" shortcut to update the diagram and recompile the model.
  • Manual Signal Dimension Specification: In some cases, manually specifying the dimensions of the signals can help. Setting the output dimensions of the "CFAR blocks" explicitly can help if the system allows for it.
  • Bus Signals: If the "CFAR block" outputs are bus signals, ensure that the bus objects are configured correctly to support variable-size signals.
Please follow the below mentioned MATLAB R2023b documentation links to know more on "Multiport Switch" and "Enabled Subsystem" respectively:
I hope this helps!




Community Treasure Hunt

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

Start Hunting!