Fortran subroutine attid1
subroutine input and utput parameters:
x(1..12),z(1..2) - attitude coefficients data set for the given time
interval corresponding to a line in attitude coefficients arrays;
ts - time in thousands of sec relative to beginning of the interval
(negative values supported) (input);
u1,u2 - direction in the S/C frame, degrees (input)
u1 - angle between vector and X axis (polar angle)
u2 - angle on the YZ plane from Y axis (anticlockwise);
dir(1..2..3) - corresponding unit vector in the GSE frame (output)
subroutine attid1(ts,u1,u2,dir)
common /z/ z(2)
common /c/ x(12)
dimension s(3),e(3),p2(3),dir(3),dra(3),pa(3,3)
ux=atan(1.)/45.*u1
uy=atan(1.)/45.*u2
dra(1)=cos(ux)
dra(2)=sin(ux)*cos(uy)
dra(3)=sin(ux)*sin(uy)
alf=x(1)+x(2)*sin(x(11)*ts)+x(3)*cos(x(11)*ts)+x(4)*sin(x(12)*ts)+
*x(5)*cos(x(12)*ts)
bet=x(6)+x(7)*sin(x(11)*ts)+x(8)*cos(x(11)*ts)+x(9)*sin(x(12)*ts)+
*x(10)*cos(x(12)*ts)
rgr = atan(1.)/45
al =alf*rgr
tga=tan(al )
be =bet*rgr
tgb=tan(be )
s(1)=1./sqrt(1.+tga**2+tgb**2)
s(2)= tga *s(1)
s(3)= tgb *s(1)
g=z(1)+z(2)*ts
ax=s(2)*cos(g)+s(3)*sin(g)
e(1)=-ax/sqrt(ax**2+s(1)**2)
e(2)=sqrt(1.-e(1)**2)*cos(g)
e(3)=sqrt(1.-e(1)**2)*sin(g)
call vect (e,s,p2)
do 1 i=1,3
pa(1,i)= s(i)
pa(2,i)= p2(i)
1 pa(3,i)= e(i)
do 2 i=1,3
2 dir(i)=0
do 3 i=1,3
do 3 j=1,3
3 dir(i)=dir(i)+pa(i,j)*dra(j)
return
end
subroutine vect(x,y,z)
dimension x(3),y(3),z(3)
z(1)=x(2)*y(3)-y(2)*x(3)
z(2)=x(3)*y(1)-x(1)*y(3)
z(3)=x(1)*y(2)-x(2)*y(1)
zz=sqrt(z(1)**2+z(2)**2+z(3)**2)
do 1 i=1,3
1 z(i)=z(i)/zz
return
end