Error in port widths or dimensions.

Error in port widths or dimensions. Output port 1 of 'last/Subsystem/powergui/EquivalentModel1/Gates/From2' is a one dimensional vector with 2 elements.
AND
Error in port widths or dimensions. Invalid dimension has been specified for input port 2 of 'last/Subsystem/powergui/EquivalentModel1/Gates/Mux'.
I am using MATLAB 2010a. problem occurred in the switching circuit of invert. Anticipating your answers...

5 comentarios

Vinay Gurram
Vinay Gurram el 27 de Dic. de 2022
Hello Sir,
Can you please let us know how to solve the error what you face with POWER GUI block? It would be a great help.
Atsafack Blondelle Melina
Atsafack Blondelle Melina el 12 de Abr. de 2023
Hello everyone!
Please, can someone help to solve this widths ou dimension error?
Munna
Munna el 9 de Ag. de 2024
Error in port widths or dimensions. Output port 1 of 'fivedof_pids/MATLAB Function' is a [5x5] matrix.
Component: Simulink | Category: Block error
Munna
Munna el 9 de Ag. de 2024
how can reduce it
Munna
Munna el 9 de Ag. de 2024
Editada: Walter Roberson el 26 de Feb. de 2025
function [M,V,G,F] = fcn(q3,q4,qd1, qd2, qd3, qd4, qd5)
%#codegen
% Parameters considered in the manipulator.
l2 = 0.2; l3 = 0.2; l4 = 0.2;
lc2 = 0.0229; lc3 = 0.0229; lc4 = 0.02229;
m1 = 1.228; m2 = 1.023; m3 = 1.023; m4 = 1.023; m5 = 0.5114;
I2zz = 0.0058; I3zz = 0.0058; I4zz = 0.0058;
Fv1 = 0.03; Fv2 = 0.025; Fv3 = 0.025; Fv4 = 0.025; Fv5 = 0.02;
gz = 9.8;
% Inertia Matrix M
M11 = m1 + m2 + m3 + m4 + m5;
M12 = 0; M21 = 0; M13 = 0; M31 = 0; M41 = 0; M14 = 0; M25 = 0;
M35 = 0; M53 = 0; M52 = 0; M45 = 0; M54 = 0;
M15 = -m5;
M51 = -m5;
M22 = lc2^2*m2 + (l2^2 + lc3^2 + 2*l2*lc3*cos(q3))*m3 + ...
(l2^2 + l3^2 + lc4^2 + 2*l2*l3*cos(q3))*m4 + ...
2*(l3*lc4*cos(q4) + l2*lc4*cos(q3+q4))*m4 + ...
(l2^2 + l3^2 + l4^2 + 2*l2*l3*cos(q3))*m5 + ...
2*(l3*l4*cos(q4) + l2*l4*cos(q3+q4))*m5 + I2zz + I3zz + I4zz;
M23 = (lc3^2 + l2*lc3*cos(q3))*m3 + ...
(l3^2 + lc4^2 + l2*l3*cos(q3) + 2*l3*lc4*cos(q4))*m4 + ...
(l2*lc4*cos(q3+q4))*m4 + ...
(l2*l4*cos(q3+q4))*m5 + ...
(l3^2 + l4^2 + l2*l3*cos(q3) + 2*l3*l4*cos(q4))*m5 + I3zz + I4zz;
M32 = M23; % Symmetric property
M24 = (lc4^2 + l3*lc4*cos(q4) + l2*lc4*cos(q3+q4))*m4 + ...
(l4^2 + l3*l4*cos(q4) + l2*l4*cos(q3+q4))*m5 + I4zz;
M42 = M24; % Symmetric property
M33 = lc3^2*m3 + (l3^2 + lc4^2 + 2*l3*lc4*cos(q4))*m4 + ...
(l3^2 + lc4^2 + 2*l2*l4*cos(q4))*m5 + I3zz + I4zz;
M34 = (lc4^2 + l3*lc4*cos(q4))*m4 + (l4^2 + l3*l4*cos(q4))*m5 + I4zz;
M43 = M34; % Symmetric property
M44 = lc4^2*m4 + l4^2*m5 + I4zz;
M55 = m5;
M = [M11 M12 M13 M14 M15; M21 M22 M23 M24 M25; ...
M31 M32 M33 M34 M35; M41 M42 M43 M44 M45; ...
M51 M52 M53 M54 M55];
% Coriolis and Centrifugal Matrix V
Vm11 = 0; Vm12 = 0; Vm13 = 0; Vm14 = 0; Vm15 = 0; Vm21 = 0; Vm25 = 0;
Vm31 = 0; Vm35 = 0; Vm41 = 0; Vm44 = 0; Vm45 = 0; Vm51 = 0; Vm52 = 0;
Vm53 = 0; Vm54 = 0; Vm55 = 0;
Vm22 = -(lc3*m3 + l3*m4 + l3*m5)*l2*sin(q3)*qd3 + ...
(l2*sin(q3+q4)*qd3 - (l3*sin(q4) + l2*sin(q3+q4)*qd4)*(lc4*m4 + l4*m5));
Vm23 = -(lc3*m3 + l3*m4 + l3*m5)*l2*sin(q3)*qd2 - ...
(lc4*m4 + l4*m5)*l2*sin(q3+q4)*qd2 - ...
((lc3*m3 + l3*m4 + l3*m5)*l2*sin(q3)*qd3) - ...
(lc4*m4 + l4*m5)*l2*sin(q3+q4)*qd3 - ...
((lc4*m4 + l4*m5)*(l3*sin(q4) + l2*sin(q3+q4))*qd4);
Vm24 = -(lc4*m4 + l4*m5)*(l3*sin(q4) + l2*sin(q3+q4)*(qd2 + qd3 + qd4));
Vm32 = (lc3*m3 + l3*m4 + l3*m5)*l2*sin(q3)*qd2 + ...
(lc4*m4 + l4*m5)*l2*sin(q3+q4)*qd2 - ...
(lc4*m4 + l4*m5)*l3*sin(q4)*qd4;
Vm33 = -(lc4*m4 + l4*m5)*l3*sin(q4)*qd4;
Vm34 = -(lc4*m4 + l4*m5)*l3*sin(q4)*(qd2 + qd3 + qd4);
Vm42 = (lc4*m4 + l4*m5)*(l2*sin(q3+q4) + l3*sin(q4))*qd2 + ...
(lc4*m4 + l4*m5)*l3*sin(q4)*qd3;
Vm43 = (lc4*m4 + l4*m5)*l3*sin(q4)*(qd2 + qd3);
V = [Vm11 Vm12 Vm13 Vm14 Vm15; Vm21 Vm22 Vm23 Vm24 Vm25; ...
Vm31 Vm32 Vm33 Vm34 Vm35; Vm41 Vm42 Vm43 Vm44 Vm45; ...
Vm51 Vm52 Vm53 Vm54 Vm55];
% Friction Vector F and Gravity Vector G
F = [Fv1*qd1 Fv2*qd2 Fv3*qd3 Fv4*qd4 Fv5*qd5];
G = [(m1 + m2 + m3 + m4 + m5)*gz ; 0 ; 0; 0; -m5 * gz].';
end
this is my code

Iniciar sesión para comentar.

 Respuesta aceptada

Dennie
Dennie el 16 de Oct. de 2015

0 votos

Hello Leo,
It is difficult to see from the pictures, but it looks like you have predefined the sizes of your signals. The dimensions of the signals going into the mux is not matching with what Simulink is expecting from the output. You can check this by double clicking on the problematic blocks and see which rule Simulink uses to determine the size and type of the signal.
To me it looks like the state space block is expecting a signal of the size 10x1, and the signal given to the mux is larger than that.
Kind regards,
Dennie

6 comentarios

Leo Sekar
Leo Sekar el 16 de Oct. de 2015
Thank You Dennie, it would be better if you can suggest the answer.
Walter Roberson
Walter Roberson el 16 de Oct. de 2015
You could possibly set the signal as "Inherit Size".
Leo Sekar
Leo Sekar el 16 de Oct. de 2015
I have tried that option also Roberson.
sandesh khadka
sandesh khadka el 1 de Dic. de 2020
can you suggest me hall decoder for bldc motor
sandesh khadka
sandesh khadka el 9 de Dic. de 2020
i have tried that option also. i can't get answer
RICHMOND
RICHMOND el 26 de Feb. de 2025
sir, can you explain more in details steps wise

Iniciar sesión para comentar.

Más respuestas (5)

Joel Van Sickel
Joel Van Sickel el 10 de Jun. de 2024

1 voto

It seems like question is getting a lot of activity, so I'll post another answer here. The issue with this type of port width issue has to do with using specialized power systems. Under the hood, ALL of the simulink signals going into your circuit go into a single simulink s -funciton. So this means all gate signals, any signals to controlled sources, any voltages torques, speeds, etc, going into machines. If you get this error, it means that your simulink model is putting the incorect size signal into the model. For instance, the model at the very top is having vectorized signals go into the gate port of a switch. The gate port of a switch only takes 1 signal. However, some other prebuilt converters might take additional signals. Unfortunately, the way specialized power systems works can make tracking this down a bit harder, and you need to pay close attention to the input sizes of all the ports. If you want to avoid this problem, you can use simscape (the blue components) and you won't have the issue, or if you do, it will point more specifically to where the problem is.
sandesh khadka
sandesh khadka el 1 de Dic. de 2020

0 votos

Invalid setting for input port dimensions of 'BLDC/DECODER/Demux1'. The dimensions are being set to [-1]. This is not valid because the total number of input and output elements are not the same

9 comentarios

sandesh khadka
sandesh khadka el 1 de Dic. de 2020
Movida: DGM el 2 de Dic. de 2023
sandesh khadka
sandesh khadka el 8 de Dic. de 2020
Movida: DGM el 2 de Dic. de 2023
Error in port widths or dimensions. Output port 1 of 'BLDC/powergui/EquivalentModel1/Sources/From3' has 2 elements. This port does not accept the dimensions (or orientation) specified by the output signal.
ABDUL LATEEF DAR
ABDUL LATEEF DAR el 9 de Abr. de 2022
Movida: DGM el 2 de Dic. de 2023
HAVE YOU GOT ANSWER SIR TO THIS PROBLEM. I AM ALSO FACING A SIMILAR PROBLEM.
Dalia
Dalia el 19 de Jul. de 2022
Movida: DGM el 2 de Dic. de 2023
me too
SALAH alatai
SALAH alatai el 1 de Nov. de 2022
Movida: DGM el 2 de Dic. de 2023
Have you solve the issue? I am also facing similar problem.
Vrinda V
Vrinda V el 2 de Mayo de 2023
Movida: DGM el 2 de Dic. de 2023
Even I face same issue.
Muhammad Kamran Mustafa
Muhammad Kamran Mustafa el 14 de Jun. de 2023
Movida: DGM el 2 de Dic. de 2023
I am also facing the same problem
Muhammad Kamran Mustafa
Muhammad Kamran Mustafa el 14 de Jun. de 2023
Movida: DGM el 2 de Dic. de 2023
how to solve this error ?
Urveshkumar Dharmendrabhai
Urveshkumar Dharmendrabhai el 20 de Sept. de 2023
Movida: DGM el 2 de Dic. de 2023
I am also facing the same problem..kindly let me know if anybody of you have got the solution

Iniciar sesión para comentar.

Haftamu Lemlem
Haftamu Lemlem el 2 de Dic. de 2023
Editada: Haftamu Lemlem el 2 de Dic. de 2023

0 votos

i know how irritating this error could be. i also encountered the same error just yesterday and i am giving this incase someone found it helpful. i was running a delta connected CHB STATCOM and got this error repeatedly. i looked for some solutions including this very page. it might be helpful for some people but it wasnt very helpful for me. this error maybe caused because of many reasons and mine was because of the a PWM generator. i used three level PWM generator after the inverse park transformation to help me generate signals for the IGBT switches. but it turns out that the PWM generator generates 12 pulses for each phase which i connected using one line. That was the mistake and it was solved as soon as i removed the PWM from the model. so there is different reasons for this error. so just focus on your model and put each and every part carefully and reasonably.
Cheers!
Haftamu!

2 comentarios

Nihal Shaji
Nihal Shaji el 20 de Mzo. de 2024
I am doing something very similar involving Field Oriented Control of a PMSM, and the connections of the FOC is giving me the same error. I used a normal PWM instead of a two level but it still didn't solve itself. Did you try anything else?
laiche zeghdi
laiche zeghdi el 24 de Mzo. de 2024
i also have same problem but i got this :''Error in port widths or dimensions. Output port 1 of 'Stat_Chikh_2_trois_niv/powergui/EquivalentModel1/Gates/From27' is a [1x2] matrix.''
and this :''Error in port widths or dimensions. Invalid dimension has been specified for input port 27 of 'Stat_Chikh_2_trois_niv/powergui/EquivalentModel1/Gates/Mux'.''
help me

Iniciar sesión para comentar.

Munna
Munna el 9 de Ag. de 2024

0 votos

Error in port widths or dimensions. Output port 1 of 'fivedof_pids/MATLAB Function' is a [5x5] matrix.
Component: Simulink | Category: Block error
RICHMOND
RICHMOND el 26 de Feb. de 2025

0 votos

Error:Error in port widths or dimensions. 'Output Port 1' of 'untitled1/powergui/EquivalentModel1/Gates/From6' is a one dimensional vector with 3 elements.
Error:Error in port widths or dimensions. Invalid dimension has been specified for 'Input Port 6' of 'untitled1/powergui/EquivalentModel1/Gates/Mux'.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 16 de Oct. de 2015

Editada:

el 26 de Feb. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by