What is the allowable signal type for the mv.target input of the linear MPC controller block?

4 次查看(过去 30 天)
Hi. I am using the matlab linear model predictive control block for wind turbine control. I am trying to include a target for the manipulated variable (turbine converter power). I am creating the mv.target signal as a 1 dimensional vector as it says is allowable in the documentation for the mpc block. However, whenever I run the simulink model I get the following error:
"Error:Error in port widths or dimensions. The signal connected to the "mv.target" port of the "WecsNoConverterFMPC/MPC Controller" block must be a scalar signal."

回答(1 个)

Namnendra
Namnendra 2024-4-16
Hi Brendan,
The error message you're encountering indicates that the `mv.target` input to the MPC Controller block expects a scalar signal, but it seems you're providing a vector instead. This discrepancy can arise due to a misunderstanding of how the target for the manipulated variable (MV) should be specified, especially in the context of a model predictive control (MPC) setup where you might have dynamic targets changing over time.
Understanding the Error:-
- Scalar vs. Vector: Even though the documentation states that `mv.target` can be a vector, this is typically in the context of having multiple manipulated variables (MVs). Each MV's target should be scalar at any given time step. If your system has only one MV (turbine converter power in your case), the target for this MV should indeed be a scalar.
- Time-Varying Targets: If you're trying to implement a time-varying target (i.e., the target changes over different time steps), you still need to ensure that at any given time step, a single scalar value is provided to the `mv.target` port.
Solutions:-
Here are a few approaches to resolve this error, depending on your specific setup and requirements:
1. Single MV Systems: Ensure that the signal connected to the `mv.target` port is a scalar. If you're generating this signal programmatically (e.g., within a MATLAB Function block or from workspace data), verify that its output at any time step is a scalar value.
2. Time-Varying Target: If the target for your MV changes over time, you can:
- Use a Signal Builder block or a similar mechanism to generate a scalar time-series signal that changes value over time.
- Implement logic (e.g., in a MATLAB Function block) that outputs the correct scalar target value for the current time step.
3. Multiple MVs: If your system actually has multiple MVs and you intended to specify targets for each, ensure that each target is routed correctly as a scalar to its corresponding `mv.target` input. This might involve using a "Demux" block to split a vector signal into scalar components if you're starting from a vector.
Example for Time-Varying Target:-
If you're implementing a time-varying target for a single MV, your approach might look something like this:
- Using a Constant Block: For a static target, simply use a Constant block with the desired scalar value.
- For Dynamic Targets: Utilize a MATLAB Function block or a Lookup Table block where the input is the simulation time (`simtime`), and the output is the target value at that time. Ensure the output is configured to be scalar.
Debugging Steps
- Check Signal Dimensions: Use a Display block or scope to verify the dimensions of the signal being fed into the `mv.target` port.
- Simulation Data Inspector: Use the Simulation Data Inspector to log and inspect the signal to ensure it's scalar over time.
By ensuring that your target signal matches the expected scalar format for the current configuration of your MPC controller, you should be able to resolve the error and proceed with your wind turbine control simulation.
I hope the above steps help resolve the issue.
Thank you.

类别

Help CenterFile Exchange 中查找有关 Controller Creation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by