Clohessy-Wiltshire equations for relative motion.
These apply to an RSW frame centered at the target spacecraft.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(6) | :: | x0 |
initial state [r,v] of chaser (at t0) [km, km/s] |
|
real(kind=wp), | intent(in) | :: | dt |
elapsed time from t0 [sec] |
||
real(kind=wp), | intent(in) | :: | n |
mean motion of target orbit ( |
final state [r,v] of chaser [km, km/s]
function cw_equations(x0,dt,n) result(x) implicit none real(wp),dimension(6),intent(in) :: x0 !! initial state [r,v] of chaser (at t0) [km, km/s] real(wp),intent(in) :: dt !! elapsed time from t0 [sec] real(wp),intent(in) :: n !! mean motion of target orbit (`sqrt(mu/a**3)`) [1/sec] real(wp),dimension(6) :: x !! final state [r,v] of chaser [km, km/s] real(wp) :: nt,cnt,snt if (dt==zero) then x = x0 else if (n==zero) then error stop 'Error: Target orbit mean motion must be non-zero.' else nt = n*dt cnt = cos(nt) snt = sin(nt) x(1) = (four-three*cnt)*x0(1) + (snt/n)*x0(4) + (two/n)*(one-cnt)*x0(5) x(2) = six*(snt-nt)*x0(1) + x0(2) - (two/n)*(one-cnt)*x0(4) + one/n*(four*snt-three*nt)*x0(5) x(3) = cnt*x0(3) + (snt/n)*x0(6) x(4) = three*n*snt*x0(1) + cnt*x0(4) + two*snt*x0(5) x(5) = -(six*n*(one-cnt))*x0(1) - two*snt*x0(4) + (four*cnt-three)*x0(5) x(6) = -n*snt*x0(3) + cnt*x0(6) end if end if end function cw_equations