Why wont the state-space block accept a mux input?
조회 수: 11 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Sam Chak
2023년 1월 4일
Hi @ymps
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)
% 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
댓글 수: 0
추가 답변 (2개)
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.
댓글 수: 0
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
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!