Error in port widths problem

22 次查看(过去 30 天)
Zuhayr Hamayun
Zuhayr Hamayun 2022-4-8
回答: Dinesh 2024-2-1
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?

回答(1 个)

Dinesh
Dinesh 2024-2-1
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.

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by