Why wont the state-space block accept a mux input?

조회 수: 11 (최근 30일)
ymps
ymps 2023년 1월 3일
답변: Sam Chak 2023년 1월 4일
I have a state space block with equation modelling the beahvoiur of a buck converter given 2 inputs [Iref and Vin].
I have tried using a Mux, a matrix concatenate and a vector concatenate to pass the 2 signals without sucsess. I get the following errors.
Error in port widths or dimensions. Output port 1 of 'MUx1' is a one dimensional vector with 2 elements.
Error in port widths or dimensions. Invalid dimension has been specified for 'Input Port 1' of 'State-Space'.
I have ensured that the dimensions match, however everytime i do that the error chnages to something new. This also happened with matrix concatenate and vector concatenate blocks
Any help on what might be causing this would be greatly appreciated.

채택된 답변

Sam Chak
Sam Chak 2023년 1월 4일
Your given state-space model is
,
and you will obviously see that it takes only a SINGLE input u after doing the matrix multiplications.
If the input u is the Voltage input , a function of the reference , where you want to regulate as , then you should design something like this
and the mux is not needed in your case.
Here is a demo in MATLAB instead Simulink. Theoretically, it should work in Simulink as well.
tspan = [0 10];
x0 = [1 0];
[t, x] = ode45(@odefcn, tspan, x0);
plot(t, x), grid on, xlabel('t')
y = x(:,1);
y(end)
ans = 0.2000
% State-space model
function xdot = odefcn(t, x)
xdot = zeros(2, 1);
% parameters
Rs1 = 1;
Rs2 = 1;
R = 1;
L = 1;
C = 1;
% elements of matrix A
a11 = - (Rs1 + Rs2 + R)/L;
a12 = - 1/L;
a21 = - 1/C;
a22 = - (Rs1 + Rs2)/C;
% system matrices
A = [a11 a12; a21 a22]; % state matrix
B = [1/L; 0]; % input matrix
% user-design stuff
K = [0.1918 -0.0937]; % user-designed matrix gain
lref = 0.2; % reference
Vin = - K*x + 2.7385*lref; % voltage input
% RLC system
u = Vin; %
xdot = A*x + B*u; % state-space
end

추가 답변 (2개)

Paul
Paul 2023년 1월 3일
The B, C, and D matrices of the state space block indicate the state space model is expecting a single input to generate a single output. At a minimum, the B and D matrices should have two columns if there will be two inputs.

Walter Roberson
Walter Roberson 2023년 1월 3일
A mux is not the same thing as a vector of values. If you need to build a vector of values use https://www.mathworks.com/help/simulink/slref/vectorconcatenate.html
  댓글 수: 1
Paul
Paul 2023년 1월 4일
I'm pretty sure there is no difference between the output of the Mux block and of the Vector Concatenate (default settings) block for scalar inputs.

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by