-- $Id: quad_shutter_05.lua,v 1.2 1998/10/15 13:59:56 gaetz Exp $ -- File : quad_shutter_05.lua -- Author : T. Gaetz -- -------------------------------------------------------------- -- Corrected axial displacement of struts; the struts are now in the -- same planes as the shutter wedgers. -- 1998/10/15 10:00:00 [TJG] -- -- Corrected axial placement to conform with RJE-19961220.txt -- 1997/07/30 11:50:00 [TJG] -- -- Repaired serious bug in state assignment. -- -- Corrected state assignment is: -- -- occc = top shutter (saosac +y) -- cocc = north shutter (saosac +x) -- ccoc = bot shutter (saosac -y) -- ccco = soutt shutter (saosac -x) -- -- (quad_shutter_01 and quad_shutter_02 erroneously had top and -- bottom flipped.) -- 1997/02/14 20:35:00 [TJG] -- -- Rename x_err, y_err, z_err to delta_x, delta_y, delta_z; move -- adjustment by delta_x, delta_y, delta_z to outermost assembly level. -- Add clocking capability. Positive clocking_error (in degrees) is in -- rotates from +x towards +y. -- 1997/02/12 17:18:30 [TJG] -- -- Annulus and strut dimensions based on data read from EKC drawings of -- shutter blades; axial positions from shutter_pos.rdb, v 1.2 -- 1996/12/24 21:34:33 [TJG] -- -- Relevant EKC drawings: -- -- EK5040-181 (2 sheets) - shutter assembly -- EK5040-183 (1 sheet) - Blade 1, shutter -- EK5040-066 (1 sheet) - Blade 3, shutter -- EK5040-067 (1 sheet) - Blade 4, shutter -- EK5040-068 (1 sheet) - Blade 6, shutter -- -- Usage note: apparently the state string has to have double quotes: -- command line version: -- aperture 'override=state="occc cccc cccc cccc"' [...] -- pset version: -- pset aperture override='state="occc cccc cccc cccc"' -- parameter file version: -- override,s,a,'state="cooo_ocoo_ooco_oooc"',,,"lua override code" -- or -- override,s,a,"state=\"ccco_ccoc_cocc_occc\"",,,"lua override code" -- ---------------------------------------------------------------------- $debug -- --------------------------------------------------------------------- deg2rad = 3.14159265358979/180.0 inch2mm = 25.4 mm2inch = 1.0/25.4 if ( nil == debug_plate ) then debug_plate = 0 end strut_width = 0.4 * 25.4 -- width of struts in mm ang_min = -46.0 * deg2rad ang_max = 46.0 * deg2rad state_lim = { { lo = 1, hi = 4 }, { lo = 0, hi = 0 }, { lo = 6, hi = 9 }, { lo = 11, hi = 14 }, { lo = 0, hi = 0 }, { lo = 16, hi = 19 } } -- 1111111111 -- 1234567890123456789 state = "cccc_cccc_cccc_cccc" -- --------------------------------------------------------------------------- -- used to select a shell and set other parameters (is) override() -- --------------------------------------------------------------------------- if ( nil == delta_x ) then delta_x = 0.0 end if ( nil == delta_y ) then delta_y = 0.0 end if ( nil == delta_z ) then delta_z = 0.0 end if ( nil == clocking_error ) then clocking_error = 0.0 end if ( nil == state ) then state = "cccc_cccc_cccc_cccc" end ------------------------------------------------------------------------------ function setup_basedata(quad) blade_radii = { { rai = 0.0, rao = 0.0, rbi = 373.380, rbo = 472.377 }, { rai = 0.0, rao = 0.0, rbi = 0.0, rbo = 0.0 }, { rai = 315.468, rao = 386.080, rbi = 441.198, rbo = 472.377 }, { rai = 258.318, rao = 328.168, rbi = 443.738, rbo = 472.377 }, { rai = 0.0, rao = 0.0, rbi = 0.0, rbo = 0.0 }, { rai = 205.740, rao = 271.018, rbi = 446.278, rbo = 472.377 } } if ( quad == 1 ) then -- top blade_pos = { { z = 3190.4305, angmin = 46.0, angmax = 134.0 }, { z = 0.0, angmin = 46.0, angmax = 134.0 }, { z = 3133.2805, angmin = 46.0, angmax = 134.0 }, { z = 3076.1305, angmin = 46.0, angmax = 134.0 }, { z = 0.0, angmin = 46.0, angmax = 134.0 }, { z = 3018.9805, angmin = 46.0, angmax = 134.0 } } elseif ( quad == 2 ) then -- north blade_pos = { { z = 3199.9555, angmin = 316.0, angmax = 44.0 }, { z = 0.0, angmin = 316.0, angmax = 44.0 }, { z = 3142.8055, angmin = 316.0, angmax = 44.0 }, { z = 3085.6555, angmin = 316.0, angmax = 44.0 }, { z = 0.0, angmin = 316.0, angmax = 44.0 }, { z = 3028.5055, angmin = 316.0, angmax = 44.0 } } elseif ( quad == 3 ) then -- bot blade_pos = { { z = 3190.4305, angmin = 226.0, angmax = 314.0 }, { z = 0.0, angmin = 226.0, angmax = 314.0 }, { z = 3133.2805, angmin = 226.0, angmax = 314.0 }, { z = 3076.1305, angmin = 226.0, angmax = 314.0 }, { z = 0.0, angmin = 226.0, angmax = 314.0 }, { z = 3018.9805, angmin = 226.0, angmax = 314.0 } } elseif ( quad == 4 ) then -- south blade_pos = { { z = 3199.9555, angmin = 136.0, angmax = 224.0 }, { z = 0.0, angmin = 136.0, angmax = 224.0 }, { z = 3142.8055, angmin = 136.0, angmax = 224.0 }, { z = 3085.6555, angmin = 136.0, angmax = 224.0 }, { z = 0.0, angmin = 136.0, angmax = 224.0 }, { z = 3028.5055, angmin = 136.0, angmax = 224.0 } } end -- end quad selection end -- End set_basedata(quad) function ------------------------------------------------------------------------------ function do_struts(shell) local theta = -30.0 local dtheta = 30.0 if ( blade_radii[shell].rai > 0 ) then xcen = 0.5 * (blade_radii[shell].rai + blade_radii[shell].rbo) slen = (blade_radii[shell].rbo - blade_radii[shell].rai) - 2.0 begin_subassembly( ) while theta < 46 do begin_subassembly( ) rotate_z ( theta * deg2rad ) translate( xcen, 0.0, 0.0 ) rect( slen, strut_width, 1, 0 ) end_subassembly( ) theta = theta + dtheta end end_subassembly( ) end end ------------------------------------------------------------------------------ function do_blade( shell ) begin_subassembly() translate( 0.0, 0.0, blade_pos[shell].z ) if ( blade_radii[shell].rao > 0.0 ) then wedger2( blade_radii[shell].rai, blade_radii[shell].rao, ang_min, ang_max, 1, 0 ) end if ( blade_radii[shell].rbo > 0.0 ) then wedger2( blade_radii[shell].rbi, blade_radii[shell].rbo, ang_min, ang_max, 1, 0 ) end do_struts(shell) end_subassembly( ) end ------------------------------------------------------------------------------ function shutter_blade( shell, quad ) begin_subassembly() ang = -90 * (quad + 2) rotate_z ( ang * deg2rad ) setup_basedata(quad) do_blade(shell) end_subassembly() end ------------------------------------------------------------------------------ function do_shell( shell ) begin_subassembly() lo = state_lim[shell].lo hi = state_lim[shell].hi quadstate = strsub(state, lo, hi) quad = 0 while quad < 4 do quad = quad + 1 if ( 'c' == strsub(quadstate,quad,quad) ) then shutter_blade(shell, quad) end end end_subassembly() end ------------------------------------------------------------------------------ begin_assembly("pass") translate( delta_x, delta_y, delta_z ) rotate_z( clocking_error * deg2rad ) do_shell(1) do_shell(3) do_shell(4) do_shell(6) end_assembly()