PRO hess ;+ ; Calculate the HESS facet mouting coordinates and angles ; Assumptions: ; Must be odd number of gratings per segment. ; Dispersion is along Y axis. ; ; 11/21/94 dd Started... ; 11/28/94 dd Modified to compare with Mike's output... ; 11/29/94 dd Modified after discussion w/Mike: ; - For Equ.2b use Rn-1 (Rnminusone) as the R value ; in place of Rcentral (RCC) ; - Implement Equ.4 for mounting hole AND ; calculate the error in grating line angle ; due to using this for mounting hole. ;- @hess_common ; Input data has already been filled by the routine ; hs_setup. ; Print useful info print, ' ' print, ' HESS facet mounting coordinate calculation' print, ' '+systime() print, ' ' print, ' X =', hs_X, ' mm' print, ' Xg of vertex =', hs_Xoff, ' mm' print, ' ' ; Master arrays for output data ; Array subscript is: ( shell, segment, grating# ) ; All are zero starting (sorry!) ; Center of grating location hs_XC = DOUBLE(FLTARR( n_elements(hs_HAf), n_elements(hs_Segs), max(hs_GpS) )) hs_YC = hs_XC hs_ZC = hs_XC ; Unit vector perp to grating membrane towards HRMA hs_XU = hs_XC hs_YU = hs_XC hs_ZU = hs_XC ; Unit vector along grating lines hs_XUL = hs_XU hs_YUL = hs_XU hs_ZUL = hs_XU ; Unit vector perp to grating lines (in plane) hs_XUD = hs_XU hs_YUD = hs_XU hs_ZUD = hs_XU ; Unit vector to mounting hole (in plane) hs_XUMH = hs_XU hs_YUMH = hs_XU hs_ZUMH = hs_XU ; Theta error - angular error due to mounting hole location hs_Terror = hs_XU ; Mounting hole coordinates hs_XMH = hs_XC hs_YMH = hs_XC hs_ZMH = hs_XC ; Go through the shells ; shell mapping shells_to_use = [1,3,4,6] ;shells_to_use = [3] FOR imap = 0,n_elements(shells_to_use)-1 DO BEGIN shell = shells_to_use(imap) is = shell - 1 ; index is one less than the shell number print, ' ' print, ' Shell =', shell print, 'Hyperbola:', hs_HAf(is), hs_HAb(is), hs_HRf(is), hs_HRb(is) print, 'Gratings : ', hs_GpS(is) print, 'Grat Dims:', hs_Doff(is), hs_Dthk(is), hs_Dspc(is) print, 'Disp ang.:', hs_Disp(is)/!DTOR, ' deg.s' ;--- EQU. 1 --- ; Calculate the off-axis angle of the center of the gratings for ; this shell theta_front = ATAN(hs_HRf(is)/hs_HAf(is)) print, 'Theta front = ', 1000.0*theta_front,' m rads' theta_back = ATAN(hs_HRb(is)/hs_HAb(is)) print, 'Theta back = ', 1000.0*theta_back,' m rads' theta_shell = DOUBLE( theta_front + theta_back )/2. print, 'Theta shell = ', 1000.0*theta_shell,' m rads' ; Go through the segments FOR iseg = 0,n_elements(hs_Segs)-1 DO BEGIN print, 'Segment = '+hs_segs(iseg) glu_ang = hs_Tglu(iseg) + hs_Disp(is) print, 'Segment gluing angle = ',glu_ang/!DTOR,' deg.s' ;--- EQU. 2 --- ; Calculate the azimuthal location of the central grating (assumes odd ; number of facets.) and the azmuthal increment between grating centers. ;--- Equ.2a --- Central grating phi phi_central = 2.*!PI*(DOUBLE(iseg)+0.5)/DOUBLE(n_elements(hs_Segs)) ;--- EQU.5a --- Subtract the dispersion offset angle from the central phi phi_central = phi_central - hs_Disp(is) igc = (hs_GpS(is)+1)/2 -1 ; central grating number print, 'central grating = ', igc+1, $ ' phi_central = ',phi_central/DOUBLE(!DTOR),' deg.s' ; Calculate the central grating center location using the hess equations ; calling format: hess_equ, theta, phi, X, D1, D2, D3 hess_equ, theta_shell, phi_central, hs_X, D1, D2, D3 ; convert equation output to our coordinates: XC = hs_Xoff - D2 YC = D3 ZC = D1 RCC = SQRT( D3^2 + D1^2 ) ; effective radius of curvature about axis ; at central grating center print, 'RadiusG = ',RCC/25.4, ' inches' ; print, 'XC, YC, ZC, RCC :', XC, YC, ZC, RCC ; print, ' ' ; Put this point and its unit vector in the data arrays hs_XC(is,iseg,igc)=XC hs_YC(is,iseg,igc)=YC hs_ZC(is,iseg,igc)=ZC length = SQRT( (hs_X-D2)^2 + (D3)^2 + (D1)^2 ) hs_XU(is,iseg,igc) = (hs_X-D2)/length hs_YU(is,iseg,igc) = D3/length hs_ZU(is,iseg,igc) = D1/length ; Save the y,z coords of central grating for use below (Equ.4) cgy = hs_YU(is,iseg,igc) cgz = hs_ZU(is,iseg,igc) ;--- EQU.6a --- Unit vector in grating line direction (perp to normal!) length = SQRT( (-D1)^2 + (hs_X-D2)^2 ) hs_XUL(is,iseg,igc) = (-D1)/length hs_YUL(is,iseg,igc) = 0.0 hs_ZUL(is,iseg,igc) = (hs_X-D2)/length ;--- EQU.6c --- Unit vector in grating dispersion direction xp = hs_X - D2 length = SQRT( (-D3*xp)^2 + (xp^2+D1^2)^2 +(-D3*D1)^2) hs_XUD(is,iseg,igc) = (-D3*xp)/length hs_YUD(is,iseg,igc) = (xp^2 + D1^2)/length hs_ZUD(is,iseg,igc) = (-D3*D1)/length ; Calculate center of other gratings in segment ;--- Equ.2B --- Change in phi from phi_central for a given parallel offset ; delta_phi = ASIN(para_off/Rn-1) ; Go through the gratings in increasing number from central one Rnminusone = RCC ; start with central R value FOR ig = igc+1, hs_GpS(is)-1 DO BEGIN para_off = hs_Dspc(is) * DOUBLE(ig - igc) phi_grat = phi_central + ASIN(para_off/Rnminusone) print, 'next grating = ', ig+1, ' phi_grat = ', phi_grat/!DTOR, ' deg.s' ; do the real work: hess_equ, theta_shell, phi_grat, hs_X, D1, D2, D3 ; convert equation output to our coordinates: XC = hs_Xoff - D2 YC = D3 ZC = D1 RC = SQRT( D3^2 + D1^2 ) ; effective radius of curvature about axis Rnminusone = RC ; save for next grating ; print, 'XC, YC, ZC, RC :', XC, YC, ZC, RC ; print, ' ' ; Put this point and its unit vectors in the data arrays hs_XC(is,iseg,ig)=XC hs_YC(is,iseg,ig)=YC hs_ZC(is,iseg,ig)=ZC length = SQRT( (hs_X-D2)^2 + (D3)^2 + (D1)^2 ) hs_XU(is,iseg,ig) = (hs_X-D2)/length hs_YU(is,iseg,ig) = D3/length hs_ZU(is,iseg,ig) = D1/length ;--- EQU.6a --- Unit vector in grating line direction (perp to normal!) length = SQRT( (-D1)^2 + (hs_X-D2)^2 ) hs_XUL(is,iseg,ig) = (-D1)/length hs_YUL(is,iseg,ig) = 0.0 hs_ZUL(is,iseg,ig) = (hs_X-D2)/length ;--- EQU.6c --- Unit vector in grating dispersion direction xp = hs_X - D2 length = SQRT( (-D3*xp)^2 + (xp^2+D1^2)^2 +(-D3*D1)^2) hs_XUD(is,iseg,ig) = (-D3*xp)/length hs_YUD(is,iseg,ig) = (xp^2 + D1^2)/length hs_ZUD(is,iseg,ig) = (-D3*D1)/length END ;gratings greater ; Go through the gratings in decreasing number from central one Rnminusone = RCC ; start with central R value FOR ig = igc-1, 0, -1 DO BEGIN para_off = hs_Dspc(is) * DOUBLE(ig - igc) phi_grat = phi_central + ASIN(para_off/Rnminusone) print, 'next grating = ', ig+1, ' phi_grat = ', phi_grat/!DTOR, ' deg.s' ; do the real work: hess_equ, theta_shell, phi_grat, hs_X, D1, D2, D3 ; convert equation output to our coordinates: XC = hs_Xoff - D2 YC = D3 ZC = D1 RC = SQRT( D3^2 + D1^2 ) ; effective radius of curvature about axis Rnminusone = RC ; save for next grating ; print, 'XC, YC, ZC, RC :', XC, YC, ZC, RC ; print, ' ' ; Put this point and its unit vector in the data arrays hs_XC(is,iseg,ig)=XC hs_YC(is,iseg,ig)=YC hs_ZC(is,iseg,ig)=ZC length = SQRT( (hs_X-D2)^2 + (D3)^2 + (D1)^2 ) hs_XU(is,iseg,ig) = (hs_X-D2)/length hs_YU(is,iseg,ig) = D3/length hs_ZU(is,iseg,ig) = D1/length ;--- EQU.6a --- Unit vector in grating line direction (perp to normal!) length = SQRT( (-D1)^2 + (hs_X-D2)^2 ) hs_XUL(is,iseg,ig) = (-D1)/length hs_YUL(is,iseg,ig) = 0.0 hs_ZUL(is,iseg,ig) = (hs_X-D2)/length ;--- EQU.6c --- Unit vector in grating dispersion direction xp = hs_X - D2 length = SQRT( (-D3*xp)^2 + (xp^2+D1^2)^2 +(-D3*D1)^2) hs_XUD(is,iseg,ig) = (-D3*xp)/length hs_YUD(is,iseg,ig) = (xp^2 + D1^2)/length hs_ZUD(is,iseg,ig) = (-D3*D1)/length END ;gratings lesser ; Go back through the gratings and calc. the mounting locations FOR ig = 0, hs_GpS(is)-1 DO BEGIN ;--- EQU.3 --- compensate for grating thickness by moving back along ; the normal by the mounting surface to membrane distance, hs_Dthk(iseg): xu = hs_XU(is,iseg,ig) yu = hs_YU(is,iseg,ig) zu = hs_ZU(is,iseg,ig) hs_XMH(is,iseg,ig)=hs_XC(is,iseg,ig) - xu*hs_Dthk(is) hs_YMH(is,iseg,ig)=hs_YC(is,iseg,ig) - yu*hs_Dthk(is) hs_ZMH(is,iseg,ig)=hs_ZC(is,iseg,ig) - zu*hs_Dthk(is) ;--- EQU.4 --- offset to mounting hole. ; Direction is radial direction of central grating center, e.g. in ; the dirction: (0., cgy, cgz). ; Want to find xumh such that the vector (xumh, cgy, cgz) is ; in the surface plane (dot prod = 0) and then normalize it. xumh = -(cgy*yu + cgz*zu)/xu yumh = cgy zumh = cgz length = SQRT(xumh^2 + yumh^2 + zumh^2) xumh = xumh/length yumh = yumh/length zumh = zumh/length ; Put the unit vector into the common variable hs_XUMH(is,iseg,ig) = xumh hs_YUMH(is,iseg,ig) = yumh hs_ZUMH(is,iseg,ig) = zumh ;--- EQU.6b --- ; Mounting hole offset unit vector is the grating line unit vector ; rotated about the surface normal by the gluing offset angle! ; Linear combination of the in-plane unit vectors: ; "Exact" mounting hole unit vector: exumh = SIN(glu_ang) * hs_XUD(is,iseg,ig) + $ COS(glu_ang) * hs_XUL(is,iseg,ig) eyumh = SIN(glu_ang) * hs_YUD(is,iseg,ig) + $ COS(glu_ang) * hs_YUL(is,iseg,ig) ezumh = SIN(glu_ang) * hs_ZUD(is,iseg,ig) + $ COS(glu_ang) * hs_ZUL(is,iseg,ig) ; Calculate the angular error between the exact and the used mounting ; hole unit vectors (use COS(theta) = dot_product ). hs_Terror(is,iseg,ig) = ACOS(xumh*exumh+yumh*eyumh+zumh*ezumh) ; Calculate the mounting hole location: hs_XMH(is,iseg,ig)=hs_XMH(is,iseg,ig) + xumh*hs_Doff(is) hs_YMH(is,iseg,ig)=hs_YMH(is,iseg,ig) + yumh*hs_Doff(is) hs_ZMH(is,iseg,ig)=hs_ZMH(is,iseg,ig) + zumh*hs_Doff(is) END ; grating mounting locations ; Do the final rotation to put dispersion axis offset from Y axis FOR ig = 0, hs_GpS(is)-1 DO BEGIN ;--- EQU.5b --- Rotate the grating unit vector, center, and mounting hole ; by the dispersion offset angle about X axis. ang = hs_Disp(is) ; IDL matrix multiply: [ansvector]= [ [column1], [column2] ] # [columnvector] Mrot = [[COS(ang),SIN(ang)],[-SIN(ang),COS(ang)]] yzrot = Mrot # [hs_YU(is,iseg,ig),hs_ZU(is,iseg,ig)] hs_YU(is,iseg,ig) = yzrot(0) hs_ZU(is,iseg,ig) = yzrot(1) yzrot = Mrot # [hs_YUL(is,iseg,ig),hs_ZUL(is,iseg,ig)] hs_YUL(is,iseg,ig) = yzrot(0) hs_ZUL(is,iseg,ig) = yzrot(1) yzrot = Mrot # [hs_YUD(is,iseg,ig),hs_ZUD(is,iseg,ig)] hs_YUD(is,iseg,ig) = yzrot(0) hs_ZUD(is,iseg,ig) = yzrot(1) yzrot = Mrot # [hs_YC(is,iseg,ig),hs_ZC(is,iseg,ig)] hs_YC(is,iseg,ig) = yzrot(0) hs_ZC(is,iseg,ig) = yzrot(1) yzrot = Mrot # [hs_YUMH(is,iseg,ig),hs_ZUMH(is,iseg,ig)] hs_YUMH(is,iseg,ig) = yzrot(0) hs_ZUMH(is,iseg,ig) = yzrot(1) yzrot = Mrot # [hs_YMH(is,iseg,ig),hs_ZMH(is,iseg,ig)] hs_YMH(is,iseg,ig) = yzrot(0) hs_ZMH(is,iseg,ig) = yzrot(1) END; final rotation END ;segments print, ' ' END ; going through the shells RETURN END