Error in port widths problem

17 views (last 30 days)
Zuhayr Hamayun
Zuhayr Hamayun on 8 Apr 2022
Answered: Dinesh on 1 Feb 2024
I've made my own version of the matlab absQuadcopter model by copying the blocks I needed from the referenced libraries used in the original model into my new one, every subsystem is contained within this one simulink (no referenced subsytems). I've removed a lot of parts too and added my own. When I run the simulation however, I get question mark symbols on every bus and wire connection like so:
I also get the following errors:
Error in port widths or dimensions. 'Input Port 1' of 'Quadcopter/Environment [Variable]/WGS84 Gravity Model ' has dimensions [?x?]. This port requires a one dimensional vector with 3 elements, or a two dimensional array of size [m x 3].
Component:Simulink | Category:Model error
Error in port widths or dimensions. 'Output Port 1' of 'Quadcopter/Environment [Variable]/Bus Selector' has 3 elements. This port does not accept the dimensions (or orientation) specified by the output signal.
Component:Simulink | Category:Model error
The errors are happening to a block modelling gravity in the environment subsystem:
The 'States' bus that should be holding the 'LLA' variable is created here: (Within the airframe subsytem)
All variables are produced into the workspace by running a matlab script before running the simulation (1 in the image). Additionally each bus (senors,states and environments) is declared in their own scripts which are also run (2 in the image) and finally each bus creator has the corresponding bus type selected for its 'Output data type' (3 in the image).
I hope I've given enough information. Why am I getting these question marks everywhere and why is there a problem with the bus widths?

Answers (1)

Dinesh
Dinesh on 1 Feb 2024
Hi Zuhayr,
The question marks in your Simulink model indicate that Simulink cannot determine the dimensions of the signals at the ports where these question marks appear. This can happen for several reasons, most commonly due to incomplete or incorrect bus definitions or because the dimensions of signals are not propagated correctly through the model.
The following are two observations:
  1. The 'WGS84 Gravity Model' block expects a one-dimensional vector with 3 elements, but the error suggests that it's receiving a signal with incompatible dimensions. This could be due to incorrect outputs from upstream blocks or incorrect setup in the 'Bus Selector'.
  2. The 'Bus Selector' block may be configured incorrectly. It should select the specific elements required by downstream blocks, and the error message suggests that it might be outputting a signal with either more elements than expected or in an incorrect format.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!