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

11 views (last 30 days)
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.

Accepted Answer

Sam Chak
Sam Chak on 4 Jan 2023
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

More Answers (2)

Paul
Paul on 3 Jan 2023
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 on 3 Jan 2023
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 Comment
Paul
Paul on 4 Jan 2023
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.

Sign in to comment.

Communities

More Answers in the  Power Electronics Control

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!