; DO some basic setup for camera evaluations FUNCTION mess1, backlash=backlash, aperture=aperture IF NOT KEYWORD_SET(backlash) THEN backlash = 1000 ; Create a Modbus-connection, later to be shared. Defaults are Ok. mb = OBJ_NEW("modbus") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, "Initialising Aperture" ; aperture is currently connected to motor2 ; TODO: ; object with endpositions and factor-function ; factor see below... aperture = OBJ_NEW("GKSS2541", factor=(8800.0-backlash)/24.0, addr='402A'XL+10, con = mb) ; Initialise the motor to values suitable for aperture: ; ; From Julia: ; ; max voltage: 24V ; ; max holding voltage: 3.1V ; ; max curent: 0.18A = 12% -> 10% ; ; 7.7um/step ; ; 24steps/revolution ; ; aperture 0mm-35mm (0St-8800St gemessen) ; ; ; ; From this I deduce ; ; max holding current 0.023A = 15% -> 10% ; ; 1mm = 130steps = 5.411255revs ; ; ; ; From the data sheet ; ; max curent: 0.24A ; ; gear reduction: 261410:1 ; ; opening time: 20s ; ; ; ; From this I deduce ; ; max. speed = 35mm/20s = 35*5.411255revs/20s = 9.5revs/s -> 5revs/s ; ; -> v_max = 5 revs/s * 24 steps/rev * 2^4 usteps/steps * 16384e-6 = 31.45728 aperture->DisableMotor aperture->InitMotor, i_max=10, i_hold=15, micro=6, full=24, v_max=1000, v_min=1, a_acc=16, a_e=2047, v_ref=250, refpos=0, backlash=backlash ; make sure current _really_ is low IF (aperture->GetMotorParam(11) NE 10) THEN BEGIN MESSAGE, "Couldn't set low current, aborting!" ENDIF ; find reference position aperture->ReferenceRun, /block ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; print, "Initialising A/D" ; brightness sensor is connected to the first AD ; NOTE: ; It is quite possible that this is now at a different address!!!!! adi = OBJ_NEW("GKSS3162", con = mb) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PRINT, "Initialising filter wheel" ; Filter wheel is on first motor filter = OBJ_NEW("GKSS2541", factor=3.0/5.0, addr='402A'XL, con = mb) ; find reference position filter->ReferenceRun, /block ; First filter is at an offset filter->MoveRelative, 0.6, /block ; Now we need to actually evaluate something, i.e. have a loop which opens ; the aperture, snaps images, does something with the images, etc... ; Ok, as a first try let's see what the relation between aperture and measured ; intensity is: n = 100 Print, "Taking "+string(2*n+1)+" measurements" print, systime() b = dblarr(2*n+1) FOR i = 0, n DO BEGIN aperture->MoveAbsolute, sqrt((1.0*i)/n), /block b[i] = adi->ReadInput(/Analog1) print, i, b[i] plot, b ENDFOR FOR j = n-1, 0, -1 DO BEGIN aperture->MoveAbsolute, sqrt((1.0*j)/n), /block b[i++] = adi->ReadInput(/Analog1) print, i-1, b[i-1] plot, b ENDFOR print, systime() ; ;; Ok, now let's see whether the combination of Lamp and A/D gives a ; ;; uniform value, for three different apertures: ; n = long(30000) ; Print, "Taking "+string(3*n)+" measurements" ; print, systime() ; b = dblarr(3*n) ; aperture->MoveAbsolute, sqrt(0.2), /block ; FOR i = 0, n-1 DO BEGIN ; b[i] = adi->ReadInput(/Analog1) ; print, i, b[i] ; plot, b ; ENDFOR ; aperture->MoveAbsolute, sqrt(0.5), /block ; FOR i = 0, n-1 DO BEGIN ; b[n+i] = adi->ReadInput(/Analog1) ; print, i, b[n+i] ; plot, b ; ENDFOR ; aperture->MoveAbsolute, sqrt(0.8), /block ; FOR i = 0, n-1 DO BEGIN ; b[2*n+i] = adi->ReadInput(/Analog1) ; print, i, b[2*n+i] ; plot, b ; ENDFOR ; aperture->MoveAbsolute, 0.1, /block ; ; Now let's try the same apertures over and over again... ; n=1000 ; b = dblarr(3*n) ; print, systime() ; FOR i = 0, n-1 DO BEGIN ; aperture->MoveAbsolute, 0.01, /block ; aperture->ReferenceRun, /block ; aperture->MoveAbsolute, 0.25, /block ; b[i] = adi->ReadInput(/Analog1) ; print, i, b[i] ; aperture->MoveAbsolute, 0.5, /block ; b[i+n] = adi->ReadInput(/Analog1) ; print, i, b[i+n] ; aperture->MoveAbsolute, 0.8, /block ; b[i+2*n] = adi->ReadInput(/Analog1) ; print, i, b[i+2*n] ; plot, b ; ENDFOR ; print, systime() return, b END