Changing delay length to solve algebraic loops

1 visualización (últimos 30 días)
astatum
astatum el 17 de Jul. de 2022
Comentada: astatum el 24 de Jul. de 2022
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 comentarios
Paul
Paul el 17 de Jul. de 2022
Why is there a loop at all? Isn't the equation just
m(t) = M0 - massused(t)
astatum
astatum el 17 de Jul. de 2022
Editada: astatum el 17 de Jul. de 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?

Iniciar sesión para comentar.

Respuesta aceptada

Paul
Paul el 18 de Jul. de 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 comentarios
Paul
Paul el 24 de Jul. de 2022
Because m_live is going to the equations of motion, it is crucial that it have no discontinuities. Otherwise, you'll have discontinuous jumps in the vehicle acceleration that are not physically possible.
So the next question is: how are the "time_on" variables computed for each thruster?
I'm going to take a guess that the simulation doesn't really need to compute "time_on" for each thruster. Rather, there's some logic (or a controller) that determines at each instant in time whether a thruster is on or off. In this case, at each instant in time, for each thruster we have a variable "thruster_is_on" which takes on the value 1 or 0. So at any instant in time.the mdot for the central thruster is
mdot_central = 0..15*central_thruster_is_on,
and then the same for the peripheral and the RCS. The total m_dot is
mdot = mdot_central + mdot_peri + mdot_RCS
Now, feed mdot into an Integrator block, and set the inital condition parameter in the integrator block to the initial mass (25 kg).
The output of the integrator is m_live.
Make sure to simulate with a variable step solver and have the zero crossing detection turned on (I believe it is by default) so the simulaton catches the jumps in the thruster on/off logic.
astatum
astatum el 24 de Jul. de 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!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by