Why I get this error in Simulink ?

81 views (last 30 days)
Hello, everyone ! First, I want to say that I am new in Matlab/Simulink. I implemented a motor model in Simulink and when I run it I keep getting this error "Invalid setting for input port dimensions of 'untitled/Back-EMF generating block from rotor position and speed/Demux2'. The dimensions are being set to 1. This is not valid because the total number of input and output elements are not the same". I found here some similar questions, saying that some idea would be to insert the block "Signal Specification", but it didn't worked. I attached an image with the error. Any idea would be helpful. Thank you very much !
A.T.

Accepted Answer

Walter Roberson
Walter Roberson on 7 Feb 2018
Perhaps you are muxing more than 3 elements onto the input and then attempting to pull off 3 elements. For example suppose that one of your input signals is a vector, so that even though you see three traces visually the resulting signal length is more than 3. mux does not package signals together with some kind of header saying how large each one was: it puts everything together into an undifferentiated vector, so the demux process needs to be told how much data to pull off for each output signal. If you do want to package up signals of different lengths and automatically unpack them to appropriate size, then you would use a bus instead of mux.
  2 Comments
A.T.
A.T. on 7 Feb 2018
Hello Walter ! Here's an mdl file, if you some time to have a look over the file to see exactly what is the problem. I am pretty sure that there are other errors but this one appears first and if you can help me with it. Thank you !
Walter Roberson
Walter Roberson on 7 Feb 2018
Your subsystem kE_analitic1 has as input the output of gain applied to D:1 Signal Specification block, which is a block that declares that the signal flowing through it is a scalar. That D:1 block is being fed from the output of the 1/s integrator block which is getting as input the output of the transfer function. The transfer function is being fed the result of the difference between the dot product block and the Tload input. The dot product block is set to take two vectors of length three, but the result of a dot product between vectors is always a scalar. So unless Tload is a vector of length 3, then the transfer function is going to be fed a scalar and so would produce a scalar, which is consistent with the D:1 specification block that says that a scalar is expected at that point.
So, your input to kE_analitic1 is a scalar. But the first thing you do inside kE_analtic1 is try to demux that scalar into 3 scalar outputs. You then apply three different mathematical expressions to the three different scalars, and then you mux those back and feed the resulting vector of three elements into further processing.
... but, as analyzed, your input is a scalar, not something that can be demuxed.
If you want to apply three different expressions to the same scalar input, do not demux: just use the same input signal for all three blocks.
So the next question is what size Tload is. And it turns out we cannot answer that. Tload is From47 -- copying data from whatever Goto47 is in the model. However, you do not have a Goto47 anywhere in the model.
You also do not have a Goto22, tag Ea, or Goto27, tag Eabc, or Goto27m tag Eb, or Goto33, tag Ec, or Goto41, tag n_ref so those signals are undefined.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Environment Customization in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!