I'm building an orbit propagator that gives the position of two satellites at time T. The position are expressed in ECI and after that are being transformed in LVLH frame (as mentioned ECI to LVLH conversion). If during the integration the satellites will collide, I want to return at time dt and to activate the thrusters that will give to the chaser satellite a velocity dv of 5m/s. As one can see in the below image, we have 2 satellites that are going to collide at a certain time. In order to avoid this, satellite 2 will active its thruster that will reduce its velocity so that a collision won't happen. The velocity vector should be in the opposite direction to velocity sat 2. Problems: How to decompose this velocity vector on x,y,z axis so that the resultant to be 5 m/s and to decelerate the satellite. As I see, I need to take account for it when I integrate the acceleration.
MATLAB functions:
Function for the first sat
function yprim=sat1(t,y)
miu=398600.4418*10^9;
magn=(y(1)^2+y(2)^2+y(3)^2)^(3/2);
yprim=zeros(6,1);
yprim(1,1)=y(4);
yprim(2,1)=y(5);
yprim(3,1)=y(6);
yprim(4,1)=double(-miu*y(1)/magn); %acceleration on x
yprim(5,1)=double(-miu*y(2)/magn); %acceleration on y
yprim(6,1)=double(-miu*y(3)/magn); %acceleration on z
end
Function for the 2nd sat
function yprim=sat2(t,y1)
miu=398600.4418*10^9;
magn=(y1(1)^2+y1(2)^2+y1(3)^2)^(3/2);
yprim=zeros(6,1);
yprim(1,1)=y1(4);
yprim(2,1)=y1(5);
yprim(3,1)=y1(6);
yprim(4,1)=double(-miu*y1(1)/magn);
yprim(5,1)=double(-miu*y1(2)/magn);
yprim(6,1)=double(-miu*y1(3)/magn);
end
LVLH conversion
er = r1 /norm(r1);% r1-position of the first sat
eh = cross(r1, v1);%v1-velocity of the first sat
eh = eh / norm(eh);
et = cross(eh, er);
dri = r2-r1;
dvi = v2-v1;
dr(1) = dot(dri, er);
dr(2) = dot(dri, et);
dr(3) = dot(dri, eh);
dv(1) = dot(dvi, er);
dv(2) = dot(dvi, et);
dv(3) = dot(dvi, eh);
dist=norm(dr); % distance between the 2 sat in lvlh
