PRO hess_to_rdb ;+ ; Calculates the facet unit vectors, prints the calculated values, ; and writes them to an rdb format file ; ; 11/22/94 dd ; 11/25/94 dd Add output in onches or mm, add distance to grating center. ; 11/28/94 dd Modified to output Direction Cosines and grating center coord.s ; and Mechanical output: center point and four in a square ; around it. ; 11/29/94 dd Add output of Theta_error due to mounting hole constraint. ; Replace unit vector dir cosines with mounting hole unit vect. ; 3/9/95 dd Modified mech_out to have mech_sqr_io, mech_sqr_l and mech_sqr_r values ; for Chris to use. ; 6/16/95 Output dir cosines for comparison with built Eng model! dd ; 10/30/97 dd Modified from hess_out.pro in order to create an ; rdb file of the as-designed HETG grating locations, etc. ; 11/3/97 dd rdb format write... ;- @hess_common ; Name for the output file rdb_out_file = 'HESSdesign.rdb' ; Use mm hs_use_inches = 0 ; Define the output structure hess_data = REPLICATE( {hessloc:'1A1', $ xc:0., yc:0., zc:0., $ xu:0., yu:0., zu:0., $ xuyf:0., yuyf:0., zuyf:0., xuxf:0., yuxf:0., zuxf:0., $ xul:0., yul:0., zul:0., xud:0., yud:0., zud:0., $ xmh:0., ymh:0., zmh:0.}, $ 336) sf = DOUBLE(1.0) fmt_x = '(F10.3)' fmt_uv = '(F10.6)' fmt_deg = '(F10.5)' if (hs_use_inches NE 0) then begin sf = DOUBLE(1./25.4) fmt_x = '(F10.4)' fmt_xx = '(F14.8)' fmt_uv = '(F10.6)' fmt_deg = '(F10.5)' end out_shells = [1,3,4,6] ; Counter for the output arrays iout = 0 FOR imap = 0, n_elements(out_shells)-1 DO BEGIN shell = out_shells(imap) is = shell-1 FOR iseg = 0, n_elements(hs_Segs)-1 DO BEGIN FOR ig = 0, hs_GpS(is)-1 DO BEGIN grat_code = STRCOMPRESS(STRING(shell,FORMAT='(I1)')+ $ STRING(hs_Segs(iseg),FORMAT='(A2)')+ $ STRING(ig+1,FORMAT='(I1)'),/REMOVE) xumh = hs_XUMH(is,iseg,ig) ; Mounting hole unit vector yumh = hs_YUMH(is,iseg,ig) ; RADIAL outward zumh = hs_ZUMH(is,iseg,ig) ; Facet Y-facet unit vector - from center to mounting hole in plane ; It is -1* sign(Doff) * radial_outward_unit_vector yf_sign = -1.0 * hs_Doff(is)/ABS(hs_Doff(is)) xuyf = yf_sign * xumh yuyf = yf_sign * yumh zuyf = yf_sign * zumh ; Save this in common hs_XUYF(is,iseg,ig) = xuyf hs_YUYF(is,iseg,ig) = yuyf hs_ZUYF(is,iseg,ig) = zuyf glu_ang = hs_Tglu(iseg) + hs_Disp(is) perp_ang = glu_ang + DOUBLE(90.0*!DTOR) ; APPROXIMATELY xpmh = SIN(perp_ang) * hs_XUD(is,iseg,ig) + $ ; Perp to mounting COS(perp_ang) * hs_XUL(is,iseg,ig) ; hole in plane ypmh = SIN(perp_ang) * hs_YUD(is,iseg,ig) + $ COS(perp_ang) * hs_YUL(is,iseg,ig) zpmh = SIN(perp_ang) * hs_ZUD(is,iseg,ig) + $ COS(perp_ang) * hs_ZUL(is,iseg,ig) ;Make pmh perp to mounting hole vector: dot_prod = xumh*xpmh + yumh*ypmh + zumh*zpmh xpmh = xpmh - dot_prod*xumh ypmh = ypmh - dot_prod*yumh zpmh = zpmh - dot_prod*zumh ; and normalize it: length = SQRT(xpmh^2 + ypmh^2 + zpmh^2) xpmh = xpmh/length ypmh = ypmh/length zpmh = zpmh/length ; Now the Xfacet unit vector is the sign(Doff) of this: xf_sign = -1.0*hs_Doff(is)/ABS(hs_Doff(is)) xuxf = xf_sign * xpmh yuxf = xf_sign * ypmh zuxf = xf_sign * zpmh ; Save this in common hs_XUXF(is,iseg,ig) = xuxf hs_YUXF(is,iseg,ig) = yuxf hs_ZUXF(is,iseg,ig) = zuxf out_string= grat_code + ' ' + $ STRING(sf*hs_XC(is,iseg,ig),FORMAT=fmt_xx) + $ ; Facet STRING(sf*hs_YC(is,iseg,ig),FORMAT=fmt_xx) + $ ; center STRING(sf*hs_ZC(is,iseg,ig),FORMAT=fmt_xx) + $ STRING(hs_XU(is,iseg,ig),FORMAT=fmt_uv) + $ ; Unit vector STRING(hs_YU(is,iseg,ig),FORMAT=fmt_uv) + $ ; along normal STRING(hs_ZU(is,iseg,ig),FORMAT=fmt_uv) + $ ; to HRMA (Facet Z) STRING(xuyf,FORMAT=fmt_uv) + $ ; Unit vector in plane STRING(yuyf,FORMAT=fmt_uv) + $ ; opposite to mounting hole direction STRING(zuyf,FORMAT=fmt_uv) + $ ; Facet Y unit vector STRING(xuxf,FORMAT=fmt_uv) + $ ; Unit vector in plane STRING(yuxf,FORMAT=fmt_uv) + $ ; perp to mounting hole direction STRING(zuxf,FORMAT=fmt_uv) + $ ; Facet X unit vector STRING(hs_XUL(is,iseg,ig),FORMAT=fmt_uv) + $ ; Unit vector STRING(hs_YUL(is,iseg,ig),FORMAT=fmt_uv) + $ ; along grating lines STRING(hs_ZUL(is,iseg,ig),FORMAT=fmt_uv) + $ ; (in plane and perp to normal) STRING(sf*hs_XMH(is,iseg,ig),FORMAT=fmt_xx) + $ ; Mounting Hole STRING(sf*hs_YMH(is,iseg,ig),FORMAT=fmt_xx) + $ ; center on HESS surface STRING(sf*hs_ZMH(is,iseg,ig),FORMAT=fmt_xx) print, out_string ;Fill the output arrays hess_data(iout).hessloc = grat_code hess_data(iout).xc = sf*hs_XC(is,iseg,ig) hess_data(iout).yc = sf*hs_YC(is,iseg,ig) hess_data(iout).zc = sf*hs_ZC(is,iseg,ig) hess_data(iout).xu = hs_XU(is,iseg,ig) hess_data(iout).yu = hs_YU(is,iseg,ig) hess_data(iout).zu = hs_ZU(is,iseg,ig) hess_data(iout).xuyf = xuyf hess_data(iout).yuyf = yuyf hess_data(iout).zuyf = zuyf hess_data(iout).xuxf = xuxf hess_data(iout).yuxf = yuxf hess_data(iout).zuxf = zuxf hess_data(iout).xul = hs_XUL(is,iseg,ig) hess_data(iout).yul = hs_YUL(is,iseg,ig) hess_data(iout).zul = hs_ZUL(is,iseg,ig) hess_data(iout).xud = hs_XUD(is,iseg,ig) hess_data(iout).yud = hs_YUD(is,iseg,ig) hess_data(iout).zud = hs_ZUD(is,iseg,ig) hess_data(iout).xmh = sf*hs_XMH(is,iseg,ig) hess_data(iout).ymh = sf*hs_YMH(is,iseg,ig) hess_data(iout).zmh = sf*hs_ZMH(is,iseg,ig) iout = iout + 1 END ;gratings END ;segments END ;shells ; Create a useful rdb header... rdb_header = ['# created by ~dd/wave/hess/hess_to_rdb.pro '+SYSTIME(), $ '# ', $ '# *** Facet location data for the 336 HETG facets ***', $ '# See the procedure hess_setup.pro and/or HETGbasic.rdb for ', $ '# the input parameters used. More details at:', $ '# http://space.mit.edu/HETG/hess/basic.html', $ '# ', $ '# .........................................................................', $ '# Column definitions:', $ '# hessloc Location code on the HESS, "shell-sector-grating"', $ '# xc Center of facet active area in X (mm)', $ '# The on-axis Rowland intercept is located at', $ '# xc = hs_Xoff = 1.7*25.4 mm; thus for flight', $ '# xc=0 is nominally at (hs_X - hs_Xoff) = (339.909-1.7)*25.4 mm', $ '# from the HRMA focal plane.', $ '# yc Center of facet active area in Y (mm)', $ '# zc Center of facet active area in Z (mm)', $ '# xu X component of facet-surface normal', $ '# yu Y component of facet-surface normal', $ '# zu Z component of facet-surface normal', $ '# These next 4 unit vectors are all in the facet plane', $ '# xuyf X component of Y-facet unit vector', $ '# yuyf Y component of Y-facet unit vector', $ '# zuyf Z component of Y-facet unit vector', $ '# xuxf X component of X-facet unit vector', $ '# yuxf Y component of X-facet unit vector', $ '# zuxf Z component of X-facet unit vector', $ '# xul X component of grating-line unit vector', $ '# yul Y component of grating-line unit vector', $ '# zul Z component of grating-line unit vector', $ '# xud X component of dispersion unit vector', $ '# yud Y component of dispersion unit vector', $ '# zud Z component of dispersion unit vector', $ '# xmh Location of facet mounting hole in X (mm)', $ '# ymh Location of facet mounting hole in Y (mm)', $ '# zmh Location of facet mounting hole in Z (mm)', $ '# .........................................................................'] ; Write the rdb file rdb_write, rdb_out_file, hess_data, HEADER=rdb_header RETURN END