SUBROUTINE CDROLL ( * * inputs: * : ROLL, * * outputs: * : INDEX, THETA1, THETA2, STATUS) * * Module Number: * * Module Name: * * Keyphrase: * ---------- * Figure out roll angles from position angles of the aperture * * Description: * ------------ * Because of the cycli* nature of the position angle, we need to find out * the "reference" roll angle whereas the other two roll angles are on * positive and negative side of it and without exceeding +/- 90 degrees. * This routine also checks to ensure the three angles cover at least 90 degrees, * i. e. no space between any two angles (in the cycli* nature) is more than * 90 degrees. * * FORTRAN Name: CDROLL.FOR * * Keywords of Accessed Files and Tables: * -------------------------------------- * Name I/O Description / Comments * None * * Subroutines Called: * ------------------- * CDBS: * None * SDAS: * UMSPUT * OTHERS: * None * * History: * -------- * Version Date Author Description * 1 07-15-86 J.-C. Hsu Design and coding * 2 10-01-87 J.-C. Hsu F77 standard *------------------------------------------------------------------------------- * *== input: * --the three roll angles REAL ROLL(1) * *== output: * --indices of the roll angles INTEGER INDEX(*), * --error status : STATUS * --the positive (offset) roll angle REAL THETA1, * --the negative (offset) roll angle : THETA2 * *== local: * --loop indices INTEGER I, J, STATOK * --angle differences REAL DIFF(2) * --error message CHARACTER*130 CONTXT, MESS *=========================begin hsp.inc========================================= * --status return code INTEGER OK, ERRNUM(20) INTEGER DEST, PRIO DATA OK /0/ DATA ERRNUM /701, 702, 703, 704, 705, 706, 707, 708, 709, 710, : 711, 712, 713, 714, 715, 716, 717, 718, 719, 720/ * --message destination and priority DATA DEST, PRIO /1, 0/ *=========================end hsp.inc=========================================== *------------------------------------------------------------------------------- * * find the angle differences among different rolls * DO 40 I = 1, 3 DO 30 J = 1, 2 DIFF(J) = ROLL(MOD(I-1+J, 3)+1) - ROLL(I) * * restrict the angle difference to be between -90 and +90 degrees * 10 IF (DIFF(J) .GT. 90.) THEN DIFF(J) = DIFF(J) - 180. GO TO 10 END IF * 20 IF (DIFF(J) .LT. -90.) THEN DIFF(J) = DIFF(J) + 180. GO TO 20 END IF 30 CONTINUE * * if the angle differences have opposite signs, and if all three angles * cover at least 90 degrees, OK. * IF (DIFF(1)*DIFF(2) .LT. 0 .AND. : ABS(DIFF(1)-DIFF(2)) .GE. 90) THEN * * assign the indices to each roll angle (index(1) is the zero roll angle, * index(2) is the positive roll angle, and index(3) is the negative roll * angle * INDEX(1) = I IF (DIFF(1) .GT. 0) THEN INDEX(2) = MOD(I,3) + 1 INDEX(3) = MOD(I+1,3) + 1 THETA1 = DIFF(1) THETA2 = DIFF(2) ELSE INDEX(3) = MOD(I,3) + 1 INDEX(2) = MOD(I+1,3) + 1 THETA1 = DIFF(2) THETA2 = DIFF(1) END IF GO TO 50 END IF 40 CONTINUE * * if the angles do not cover more than 90 degrees, put error message and exit * CONTXT = 'coverage of roll angles is less than 90 degrees' STATUS = ERRNUM(1) GO TO 999 * 50 CONTINUE * STATUS = OK GO TO 1000 * 999 MESS = 'CDROLL: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END