Referenced model contains an algebraic loop. Referenced models do not support algebraic loops
18 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
madhan ravi
on 11 Jan 2024
Edited: madhan ravi
on 11 Jan 2024
As seen in the preview of the Referenced Model, there is a feedback to a subsystem make sure to add a Unit Delay block to the feedback path. As suggested in the link below:
Several methods to eliminate the problem
0 Comments
More Answers (1)
Hassaan
on 11 Jan 2024
Edited: Hassaan
on 11 Jan 2024
Here's what you can do to troubleshoot and potentially resolve the issue:
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- Check Documentation: MATLAB documentation and user forums might have specific advice for handling algebraic loops in MPC structures.
- 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.
0 Comments
See Also
Categories
Find more on Controller Creation 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!