Simulink algebraic loop unsolved

55 views (last 30 days)
Kevin
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
  2 Comments
Kevin
Kevin on 17 Mar 2015
Edited: Kevin on 17 Mar 2015
Thanks, actually after like a lot of research and reading, I found those elements:
-Firstly, when using simscape component, if you are trying to introduce an algebraic loop, you should NOT have simscape component AND algebraic component in the loop. Here is a good example and explanation of this issue. Also there is a solution presented
-Secondly, you'are right, if the solver cannot converge during one simulation step, then there will be a crash. This can happen when you have DIRECT FEEDTRHOUght.Direct feedtrhough are when the input of a block is reused at its output directly. When you do direct feedtrhought in an loop (control loop, or whatever), your calculation will just diverge (not meaning by that that it will tend to be infinite, but that it will never converge). You can solve the probleme by adding a transfert function (like a delay) which will not produce direct feed through. Also be careful about just using one delay block. I think I read somewhere that this probleme wasn't solved withj only 1 delay. Try then to use 2 delay...
-Thirdly, The first time I solved the probleme by using the blocks DATA STORE READ and DATA STORE WRITE that you can find in the Simulink/signal routing library. By introducing them, you will "break" the loop, althought the functionment will be the same.
Thanks for the answer, and for future users, I hope that I could Help you solve this annoying problem. I'VE ATTACHED MY FILE WHICH IS WORKING NOW
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.
Cheers!

Sign in to comment.

Categories

Find more on General Applications in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!