Compute the transformation matrices to convert IJK to LVLH.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(3) | :: | r |
position vector of target [km] |
|
real(kind=wp), | intent(in), | dimension(3) | :: | v |
velocity vector of target [km/s] |
|
real(kind=wp), | intent(in), | optional, | dimension(3) | :: | a |
acceleration vector of target [km/s^2] (if not present, then a torque-free force model is assumed) |
real(kind=wp), | intent(out), | dimension(3,3) | :: | c |
C transformation matrix |
|
real(kind=wp), | intent(out), | optional, | dimension(3,3) | :: | cdot |
CDOT transformation matrix |
subroutine from_ijk_to_lvlh_mat(r,v,a,c,cdot) use vector_module, only: unit, cross, uhat_dot implicit none real(wp),dimension(3),intent(in) :: r !! position vector of target [km] real(wp),dimension(3),intent(in) :: v !! velocity vector of target [km/s] real(wp),dimension(3),intent(in),optional :: a !! acceleration vector of target [km/s^2] !! (if not present, then a torque-free force model is assumed) real(wp),dimension(3,3),intent(out) :: c !! C transformation matrix real(wp),dimension(3,3),intent(out),optional :: cdot !! CDOT transformation matrix real(wp),dimension(3) :: ex_hat,ex_hat_dot real(wp),dimension(3) :: ey_hat,ey_hat_dot real(wp),dimension(3) :: ez_hat,ez_hat_dot real(wp),dimension(3) :: h,h_hat,h_dot h = cross(r,v) h_hat = unit(h) ez_hat = -unit(r) ey_hat = -h_hat ex_hat = cross(ey_hat,ez_hat) c(1,:) = ex_hat c(2,:) = ey_hat c(3,:) = ez_hat if (present(cdot)) then ez_hat_dot = -uhat_dot(r,v) if (present(a)) then h_dot = cross(r,a) ey_hat_dot = -uhat_dot(h, h_dot) ex_hat_dot = cross(ey_hat_dot,ez_hat) + cross(ey_hat,ez_hat_dot) else !assume no external torque ey_hat_dot = zero ex_hat_dot = cross(ey_hat,ez_hat_dot) end if cdot(1,:) = ex_hat_dot cdot(2,:) = ey_hat_dot cdot(3,:) = ez_hat_dot end if end subroutine from_ijk_to_lvlh_mat