필터 지우기
필터 지우기

Switching between two integrators, spacecsaft dynamics

조회 수: 5 (최근 30일)
Kacper Dobrowolski
Kacper Dobrowolski 2023년 4월 27일
댓글: Kacper Dobrowolski 2023년 4월 28일
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
Sam Chak
Sam Chak 2023년 4월 27일
Can you show the spacecraft dynamics?
At the altitude that is more than 6000 km, the spacecraft 🛰 should be orbiting Earth 🌎.
Kacper Dobrowolski
Kacper Dobrowolski 2023년 4월 27일
This is how the gravity force is calculated
And this is the other model based on the orbital equation. The dynamics are correct in terms of maths as far as i know
The altitude is about 300-400 km

댓글을 달려면 로그인하십시오.

채택된 답변

Sara Nadeau
Sara Nadeau 2023년 4월 27일
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?

추가 답변 (1개)

chicken vector
chicken vector 2023년 4월 27일
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.
Try to have a look at Gauss Variational Equations.
If you prefer to use Cartesian, then post your code and people can help you to find the issue.

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by