Changing delay length to solve algebraic loops
Show older comments
Edit: Uh oh. I found out that it worked because my signals were one seconds long and was exactly starting at for example sec 1 and ending at sec 3. After changing to non-integer time values, that method also does not works. But still wonder why.
I am using an algebraic loop for a mass-change model. Basically it subtracts the mass of fuel used from the initial mass of vessel. The initial mass is 25 kg and the subtracted mass is variable with time and throttle. At first I used an initial condition block for the process, but eventually it just crashes with an algebraic loop error.

So i tried to use an delay block for the job. It works but the problem is, the values are totally wrong when i use it with a delay length of 1:

I included my mdot mass flow rates to better explain my range of subtraction. Certainly, the output values are totally wrong as i am applying them for just a few seconds. So, i tried to increase the delay length to 1000, and the results are almost identical to what it is supposed to be:

There is some peaks at the end, but i think they are not the main problem here. I wonder why when the delay increases, the outputs get more realistic?
Also, is this a correct way to solve an algebraic loop, at least for my mass change model?
2 Comments
Paul
on 17 Jul 2022
Why is there a loop at all? Isn't the equation just
m(t) = M0 - massused(t)
Accepted Answer
More Answers (0)
Categories
Find more on General Applications 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!