CS_flexure_slits.pmc

Go to the documentation of this file.
00001 CLOSE
00002 
00003 ;################################################
00004 ;; \file
00005 ;; Define motion for flexure slits
00006 ;;
00007 ;; Original Author: Alan Greer
00008 ;;
00009 ;; Defined axes:
00010 ;; - X (addr 6) = gap in same EGUs as actuator
00011 ;;
00012 ;; Macros:
00013 ;; - COORD = $(COORD)  CS number, e.g. 2
00014 ;; - PLC = $(PLC)  PLC number, should be CS number+15, e.g. 17
00015 ;; - AS = $(AS)  Axisnum for actuator stroke, e.g. 1
00016 ;; - LL = $(LL)  Lever length in mm
00017 ;; - SW = $(SW)  Slit width at U=0 in mm
00018 ;################################################
00019 
00020 ; Change to CS$(COORD)
00021 &$(COORD)
00022 
00023 ; Set relevant axes to use kinematics
00024 #$(AS)->I ; +ve blade
00025 
00026 ; These are set by motor_in_cs.template
00027 #define ASMOVE P(4700+$(AS))
00028 #define ASMRES P(4800+$(AS))
00029 #define ASOFF  P(4900+$(AS))
00030 
00031 ; Lever length
00032 #define LEVERLENGTH Q20
00033 LEVERLENGTH = $(LL)
00034 ; Slit width
00035 #define SLITWIDTH Q21
00036 SLITWIDTH = $(SW)
00037 
00038 ; Calculate Gap from actuator position
00039 #define ASPOS (ASMRES*P$(AS)+ASOFF)
00040 #define GAP Q7
00041 OPEN FORWARD
00042 ; X = Q7 = gap in mm = (SW + 2LL(1-cos(arcsin(Actuator/LL))))
00043 ; The formula used for this calculation can be found in the document
00044 ; 100208 FAT protocol 301.pdf
00045 ; located in
00046 ; S:\Technical\Engineering\Beamline Eng\I10\Design (AndyM & A Day)\beamline components\14_Exit slits S4\FATS
00047 CLEAR
00048     GAP=SLITWIDTH+2*LEVERLENGTH*(1-COS(ASIN(ASPOS/LEVERLENGTH)))
00049 CLOSE
00050 
00051 OPEN INVERSE
00052 #define ASPOS Q228
00053 CLEAR
00054     ; calculate actuator pos in EGUs
00055     ASPOS = LEVERLENGTH*SIN(ACOS(1-(GAP-SLITWIDTH)/(2*LEVERLENGTH)))
00056     ; then in cts
00057     P$(AS)=(ASPOS-ASOFF)/ASMRES
00058 CLOSE
00059 
00060 ; A PLC(sx+15) needs to be made to do position reporting
00061 ; Readbacks should be in &{axisnum}Q81..89
00062 ; As forward kinematic, but with Px = mx62/(Ix08*32)
00063 #define ASPOS (ASMRES*m$(AS)62/(I$(AS)08*32)+ASOFF)
00064 #define GAP Q87
00065 OPEN PLC$(PLC)
00066 CLEAR
00067     ADDRESS&$(COORD)
00068     GAP=SLITWIDTH+2*LEVERLENGTH*(1-COS(ASIN(ASPOS/LEVERLENGTH)))
00069     ; If actuator motor record did the last move, set demands = readbacks
00070     ; This is not really needed as there is only one axis, but we'll put it
00071     ; in just in case
00072     if (ASMOVE = 1)
00073         ASMOVE = 0
00074         Q77 = Q87
00075     endif
00076 CLOSE
00077 ENABLE PLC$(PLC)
 All Classes Files Functions Variables Typedefs Defines