Clear Filters
Clear Filters

Error in port widths or dimensions.

15 views (last 30 days)
Mounira
Mounira on 13 Dec 2023
Answered: Gowtham on 20 Dec 2023
Hello,
so i have a model; dx'= Ax+ B*u; and y=Cx+Du; with one input and one output, and output=state;
this model is represented with state space representation in simulink, and i want to connect this to Model predictive controller, but I kepp getting this error that : "The signal connected to the "mo" port of the "statespacerepresentation/MPC Controller" block must be a scalar signal."
so the question is why?
thanks in advance for the answer

Accepted Answer

Gowtham
Gowtham on 20 Dec 2023
Hello Kawsar,
It is my understanding that you are trying to connect the output of a Simulink model to the mo port of the MPC Controller from the Model Predictive Controller Toolbox.
I tried to reproduce the issue at my end, and it ran smoothly. Your approach and the model appear to be aligned with the specified equation. However, the error indicates that the output from your state-space model, which you're feeding into the MPC, isn't a scalar as required by the MPC block. The signal should have a dimensionality of 1, since the MPC is intended to accept only a single scalar value for its measured output.
I suggest you take the following precautions to resolve the issue:
  • Check the dimensions of C and D: Their dimensions must be such that their sum of product with x and u should be a scalar.
  • Signal dimensions in Simulink: Make sure that the actual signal being output from your state-space block is a scalar. You can use the Signal Specification block to enforce a signal to be a scalar if necessary.
  • MPC Controller Block: Double-check the MPC Controller block settings. Ensure that the Measured output (mo) port is configured to accept a scalar signal. The MPC block should be set up to match the dimensions of your system.
Kindly refer to the following MATLAB Documentation(s) for further information on MPC Controller Block and Signal Specification Block:
Hope this helps.
Best Regards,
Gowtham

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!