Referenced model contains an algebraic loop. Referenced models do not support algebraic loops

23 次查看(过去 30 天)
Hello,
so i have a dc microgrid model and i have a model predictive controller using simulink in Matlab, and i want to run the model predictive controller with the microgrid model, and in MPC you have to import signals from the microgrid model into the MPC first, so I tried to put the microgrid model as a parent model, and the MPC as a referenced model, but i am getting this error: Referenced model contains an algebraic loop. Referenced models do not support algebraic loops.
this figure shows the 2 models:the small block alone is the referenced model,
so what is the solution?
thanks in advance

采纳的回答

madhan ravi
madhan ravi 2024-1-11
编辑:madhan ravi 2024-1-11

更多回答(1 个)

Hassaan
Hassaan 2024-1-11
编辑:Hassaan 2024-1-11
Here's what you can do to troubleshoot and potentially resolve the issue:
  1. Introduce Delays: Check if you can introduce a delay in the feedback loop that is causing the algebraic loop. Even a single time-step delay can sometimes resolve the issue by breaking the algebraic dependency.
  2. Direct Feedthrough: Check if any blocks within the MPC referenced model have direct feedthrough (i.e., the output directly depends on the input). Try to eliminate direct feedthrough if possible or replace it with blocks that do not have direct feedthrough.
  3. Model Discretization: If your MPC is designed for continuous-time implementation, consider discretizing the controller. Discrete controllers inherently have a delay (at least one time step) and may help resolve algebraic loops.
  4. Solver Configuration: Look at your solver configuration. Try changing the solver to a fixed-step solver if you are using a variable-step solver, as some algebraic loops can be handled with fixed-step solvers.
  5. Subsystem Boundary: Check if moving some parts of the computation from the referenced model to the parent model (or vice versa) could break the algebraic loop. Sometimes the way you partition the logic between the parent and the referenced model can impact whether an algebraic loop is formed.
  6. Utilize MPC Block: If you are building the MPC structure manually, consider using the built-in MPC block provided by MATLAB if available. This block is designed to handle many of the intricacies of MPC implementation, including avoiding algebraic loops.
  7. State Estimation: If your MPC controller uses state feedback and the states are estimated within the controller, ensure that the state estimator does not create an algebraic loop. You may need to revise the state estimation strategy.
  8. Check Documentation: MATLAB documentation and user forums might have specific advice for handling algebraic loops in MPC structures.
  9. Contact MathWorks Support: If none of these solutions work, consider reaching out to MathWorks technical support. They can provide more targeted advice, especially if there's a need to look at the detailed implementation of your MPC.
For complex models and controllers, resolving algebraic loops may require a thorough analysis of the signal flow and dependencies within your models. It's often a trial and error process to identify the exact source of the loop and the best way to resolve it.
---------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

类别

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

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by