MATLAB Answers

Simulink algebraic loop unsolved

182 views (last 30 days)
Kevin on 25 Feb 2015
Commented: Leonardo Malburg on 30 Mar 2021
Good evening, I am currently developping the control program of a BUCK. My idea is to take simultaneously the input and output voltage and compute a duty cycle from there (basically a feedforward).
My simulation encounter a problem when I want to feed information coming from the output to the PWM Block (which mean that when I give the duty cycle calculated with the input and output, it crashes)
I give you the schematic (the most updated version is the one on the rigth) and the error message: An error occurred while running the simulation and the simulation was terminated
Simulink cannot solve the algebraic loop containing 'charger_caracterisation/Solver Configuration/EVAL_KEY/INPUT_1_1_1' at time 1.0E-5 using the LineSearch-based algorithm due to one of the following reasons: the model is ill-defined i.e., the system equations do not have a solution; or the nonlinear equation solver failed to converge due to numerical issues. To rule out solver convergence as the cause of this error, either a) switch to TrustRegion-based algorithm using set_param('charger_caracterisation','AlgebraicLoopSolver','TrustRegion') b) reducing the VariableStepDiscrete solver RelTol parameter so that the solver takes smaller time steps. If the error persists in spite of the above changes, then the model is likely ill-defined and requires modification.
The problem occurs only when I take information from the output, the input isn't problematic when I feed it to the algebraic loop._
Of course I tried the solutions proposed by simulink when it crashed, but nothing works.
  • I removed non linear element, and especially the switches who induce discontinuities (which I wanted to use in order to perform a soft start) DONE->NO EFFECT
  • I defined the priorities of some blocks: I don't want simulink to compute the duty_cycle before it compute the output. It wouldn't make any sense, even for me. DONE->NO EFFECT
  • I am currently trying to suppress every direct feedthrough from this loop: I use the memory blocks to do that for the moment. I may have to use other tricks to achieve this goal. IMPOSSIBLE
  • I may have to initialyse the physical conditions to help the solver by being closer to the solution, and then help it to converge. PARTIALLY DONE ->POSITIV RESULTS (but still doesn't work)
  • Use of IC blocks to initialize values of feedthrough signals DONE ->POSITIV RESULTS (but still doesn't work)
  • Initialization of current value in the inductor to prevent simulink from beginning the simulation in a weird initial state (like with tension rising above 40kV...) DONE, WORKING when not using feed forward
  • I will also try to increase the number of iterations made by the solver when attempting to converge. UNDONE
I don't want to use a PID, because the final application of this controller is not only for a BUCK. I'll keep on looking, but if someone have a quick solution, I would gladly accept it.

Answers (1)

Sebastian Castro
Sebastian Castro on 4 Mar 2015
The reason the output (and not the input) affect your algebraic loop is related to the definition of algebraic loops . These occur in Simulink when you're trying to feed an input to a system which is directly related to an output of the same system. Since Simulink can't figure out how to break this circular relationship, it uses numerical iterations to try find an answer. For the particular model you're making, this iterative solution cannot be found, which is why you see the error message.
Another thing that may help to understand it is that Simulink looks at the entire Simscape/SimElectronics physical network as "one big block", which is why you see an algebraic loop even though you have many blocks between the input and output of your electrical system. Again, think of the entire electrical circuit as one connected "blob" of simultaneous equations.
Anyhow, since your algebraic loop is related to a control algorithm, it's generally "okay" to introduce a delay in your system to break the loop. This can typically be done with a Unit Delay block, whose sample time should be set to the sample time of the controller you're designing.
Note that this is (for the most part) an acceptable solution only when you're dealing with control systems, since it's realistic for you to measure something at a particular time T and then use that measurement for your input at a time T+1. Give that a try!
- Sebastian
Leonardo Malburg
Leonardo Malburg on 30 Mar 2021
Hi Kevin,
Altough 6 (and 13 days, LOL) years later, your tips helped me a lot with loops on a RL Model, and thumbs up for the third one.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!