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?
  2 Comments
astatum
astatum on 17 Jul 2022
Edited: astatum on 17 Jul 2022
@Paul It needs to be real-time as the controller response and fuel use are different every run. By the way, I really am not sure how should I do this. Isn't what I done and your equation the same?

Sign in to comment.

Accepted Answer

Paul
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.
  5 Comments
astatum
astatum on 24 Jul 2022
Since I am using a discrete-time solver for simulink due to my project conditions, I just tried it with discrete time integrator. And it works :))
Here is a picture with real actuation time inputs fed into the system:
I used an first-order hold block to make sure that signal is pseudo-continuous, for the sake of smooth equations of motion calculation.
Many thanks!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!