Changing delay length to solve algebraic loops
3 views (last 30 days)
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?
Paul on 18 Jul 2022
Refering to the block diagram at the top of the question ....
Would it be correct to replace the IC block with a Constant block with the "Constant value" parameter set to 25? There is no input ot the Constant block, hence no loop.