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