Go to the documentation of this file.00001 CLOSE
00002
00003 ;################################################
00004 ;; \file
00005 ;; Define single bending mirror actuator to radius of curvature translation
00006 ;;
00007 ;; Author: Ronaldo Mercado
00008 ;;
00009 ;; Defined axes:
00010 ;; - X (addr 6) = Radius of curvature in km
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 ;; - J1 = $(J1) Axisnum for bending actuator
00016 ;; - SLOPE = $(SLOPE) slope [1/Km / mm ]
00017 ;; - INTERCEPT = $(INTERCEPT) intercept [1/Km]
00018 ;; - LIMIT = $(LIMIT) [Km] where the CS stops operating
00019 ;;
00020 ;; This CS relies on the fit presented in SCI-OPT-REP-0058
00021 ;; where 1/R is ~ linear with the number of counts
00022 ;################################################
00023
00024 ; The CS axis is the radius of curvature with
00025 ; EGU in Km.
00026 ; There is a discontinuity in R when 1/R is zero
00027 ;
00028 ; Change to CS$(COORD)
00029 &$(COORD)
00030 ; The fit provided by metrology
00031 ; 1/R = SLOPE * J1 + INTERCEPT
00032 ; slope [1/Km / mm ]
00033 #define SLOPE Q20
00034 ; intercept [1/Km]
00035 #define INTERCEPT Q21
00036 ; Limit where CS stops operating [Km]
00037 #define LIMIT Q22
00038 SLOPE = $(SLOPE)
00039 INTERCEPT = $(INTERCEPT)
00040 LIMIT = $(LIMIT)
00041
00042 ; These are set by motor_in_cs.template
00043 #define J1MOVE P(4700+$(J1))
00044 #define J1MRES P(4800+$(J1))
00045 #define J1OFF P(4900+$(J1))
00046
00047 ; Set relevant axes to use kinematics
00048 #$(J1)->I ; actuator
00049
00050 ; Calculate radius of curvature from jack position
00051 #define J1POS (J1MRES*P$(J1)+J1OFF)
00052 #define RADIUS Q7
00053 #define SETERROR M(100*$(COORD)+5082)=1
00054 OPEN FORWARD
00055 CLEAR
00056 ; This is the radius. Has singularity (Inf) at TRANSLATION = -INTERCEPT/SLOPE
00057 IF ( ABS(J1POS+INTERCEPT/SLOPE) !< ABS(1/LIMIT/SLOPE) )
00058 RADIUS=1.0/(SLOPE *J1POS + INTERCEPT)
00059 ELSE
00060 SETERROR
00061 ENDIF
00062 CLOSE
00063
00064 ; work out the actuator position from the radius of curvature
00065 #define J1POS Q228
00066 OPEN INVERSE
00067 CLEAR
00068 ; calc in EGUs
00069 J1POS=((1/RADIUS-INTERCEPT))/SLOPE
00070 ; then in cts
00071 P$(J1)=(J1POS-J1OFF)/J1MRES
00072 CLOSE
00073
00074 ; A PLC(sx+15) needs to be made to do position reporting
00075 ; Readbacks should be in &{axisnum}Q81..89
00076 ; As forward kinematic, but with Px = mx62/(Ix08*32)
00077 #define J1POS (J1MRES*m$(J1)62/(I$(J1)08*32)+J1OFF)
00078 #define RADIUS Q87
00079 OPEN PLC$(PLC)
00080 CLEAR
00081 ADDRESS&$(COORD)
00082 ; This is the radius. Has singularity (Inf) at J1POS = -INTERCEPT/SLOPE
00083 IF ( ABS(J1POS+INTERCEPT/SLOPE) !< ABS(1/LIMIT/SLOPE) )
00084 RADIUS=1.0/(SLOPE *J1POS + INTERCEPT)
00085 ENDIF
00086 ; If actuator motor record did the last move, set demands = readbacks
00087 ; This is not really needed as there is only one axis, but we'll put it
00088 ; in just in case
00089 if (J1MOVE = 1)
00090 J1MOVE = 0
00091 Q77 = Q87
00092 endif
00093 CLOSE
00094 ENABLE PLC$(PLC)
00095