Switching between two integrators, spacecsaft dynamics
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Kacper Dobrowolski
le 27 Avr 2023
Commenté : Kacper Dobrowolski
le 28 Avr 2023
Hi everyone
I am making a simulation of spacecraft flight in simulink. I want to use two different dynamics models simultaneously.
First I wanted to simulate the spacecraft motion by dividing the resultant force by mass of the spacecraft and then integrating acceleration and velocity. That counterintuitively resulted in the spacecraft falling below the Earth's surface. So in order to get rid of this problem and force the spacecraft to have a Keplerian trajectory I decided to integrate the derivative of the true anomaly (which I defined as orbital momentum divided by range squared), keeping the other orbital elements fixed, and calculate the range (between Eatrh and spacecraft CoG) based on that. With this method I can achieve clean elliptical orbits but I cannot take into account the orbital manoeuvres and thrust and other transient effects. So I came up with an Idea to switch between these two models - use the true anomaly integrating model for free floating periods and switching to the acceleration integrating method for thrust impulses.
For that I made two enabled subsystems. First one was supposed to be on while the main thruster was off. Then, when the thruster was ignited, the first subsystem was disabled and the spacecraft state (position and velocity) was set to "held" so it could be relayed to the other subsystem. The other subsystem used the signal of "thruster ignited" as a trigger to reset its integrator and use the held output of the former as initial condition and so forth.
To the point: I cannot get them to cooperate, they do not seem to reset each other's state. When models switch the current one starts from the point it finished calculation at and not from the input initial condition. I post the plot (the spikes are the acceleration integrating model and the rest is the other) and parts of code to show how it behaves and how I made it. I realize there are nasty algebraic loops inside but I do not know how to fix them without abandoning the whole concept of switching models.
Can you tell me what I am doing wrong and if it is even doable to switch models like that?
I am sorry if I am being unclear. I am more than happy to clarify. Many thanks to anyone that decides to pick this up.
Cheers
Kacper
2 commentaires
Sam Chak
le 27 Avr 2023
Can you show the spacecraft dynamics?
At the altitude that is more than 6000 km, the spacecraft 🛰 should be orbiting Earth 🌎.
Réponse acceptée
Sara Nadeau
le 27 Avr 2023
I am not entirely sure whether this would solve the problems you're seeing. The second example on this page shows how to use the optional State port on the Integrator block to pass state values between enabled subsystems. https://www.mathworks.com/help/simulink/slref/integrator.html#mw_81ab2b89-b24c-4e2a-be9b-5faead7e1e44
The model is much simpler to illustrate just this core concept, and there's a bit more focus on the elimination of algebraic loops. Perhaps it can still help?
Plus de réponses (1)
chicken vector
le 27 Avr 2023
I highly discoruage you to switch between dynamical systems because you are making your life much harder for no reason.
First, the integration in Cartesian coordinates should work. If the satellite falls on Earth it was either supposed to fall due to its initial conditions, or your implementation of the dynamic system was wrong.
Then, deciding between Keplerian and Cartesian coordinates is just a metter of taste.
Personally I prefer using Keplerian coordinates, but both can be used to model low-thrust manoeuvres.
If you prefer to use Cartesian, then post your code and people can help you to find the issue.
0 commentaires
Voir également
Catégories
En savoir plus sur Aerospace Applications dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!