DECLARE SUB bit488geti (i!) DECLARE SUB bit488seti (i!) DECLARE SUB hp3457cmon (c%) DECLARE SUB hp3457cv (c%, v!) DECLARE SUB ibopcheckpar (ok$) DECLARE SUB ibopramp (rr!, inom!) DECLARE SUB iboprampfr (rr!, fr!, ifin!) '**************************************************************************** 'Module IBOP 'This module contains drivers to set and measure the magnet current using 'the Kepco power supply. ' 'Zachary Wolf '5/31/94, 7/28/95 '**************************************************************************** 'Common area for shared parameters COMMON SHARED /ibop/ imaghpchanP%, vtransperimagP!, imagtstableP% SUB ibopcheckpar (ok$) '**************************************************************************** 'This subroutine checks that all required parameters have been assigned 'values. ' 'Output: ' ok$, "y" if parameter assignments are ok, "n" otherwise ' 'Zachary Wolf '9/18/95 '**************************************************************************** 'Default value ok$ = "n" 'imaghpchanP% IF imaghpchanP% < 0 OR imaghpchanP% > 9 THEN PRINT "IBOP: imaghpchan has improper value" EXIT SUB END IF 'vtransperimagP! IF vtransperimagP! <= 0 OR vtransperimagP! > 2 THEN PRINT "IBOP: vtransperimag has improper value" EXIT SUB END IF 'imagtstableP% IF imagtstableP% < 0 OR imagtstableP% > 120 THEN PRINT "IBOP: imagtstable has improper value" EXIT SUB END IF 'If we made it this far, all parameters have values ok$ = "y" END SUB SUB ibopgeti (imag!) '**************************************************************************** 'This subroutine gets the transductor output voltage. It then applies 'the calibration constant to get the magnet current. ' 'Output: ' imag!, the measured magnet current ' 'Zachary Wolf '4/21/94, 1/5/95, 7/28/95 '**************************************************************************** 'Make sure all parameters have been assigned reasonable values CALL ibopcheckpar(ok$) IF ok$ <> "y" THEN imag! = 0! EXIT SUB END IF 'Measure the voltage from the transductor CALL hp3457cv(imaghpchanP%, v!) 'Apply the conversion factor imag! = v! / vtransperimagP! END SUB SUB ibopinit '**************************************************************************** 'This subroutine does the initial turn on of the power supply to a small 'current. ' 'Zachary Wolf '10/1/95 '**************************************************************************** 'Message PRINT PRINT "Initial power supply turn on." PRINT "Ramp the supply to 2 A, stabilize, ramp to 0..." 'Ramp the supply CALL ibopramp(1!, 2!) 'Stabilize SLEEP 5 'Ramp to 0 CALL ibopramp(1!, 0!) END SUB SUB ibopmonitor '**************************************************************************** 'This subroutine sets up the HP3457 to monitor the transductor. ' 'Zachary Wolf '7/27/95 '**************************************************************************** 'Make sure all parameters have been assigned reasonable values CALL ibopcheckpar(ok$) IF ok$ <> "y" THEN EXIT SUB 'Set the DVM so the current can be monitored CALL hp3457cmon(imaghpchanP%) END SUB SUB ibopramp (rr!, inom!) '**************************************************************************** 'This subroutine supervises the ramp of the magnet current. ' 'Input: ' rr!, the current ramp rate ' inom!, the desired magnet current ' 'Zachary Wolf '1/1/95 '**************************************************************************** 'Make sure all parameters have been assigned reasonable values CALL ibopcheckpar(ok$) IF ok$ <> "y" THEN EXIT SUB 'First ramp to 90% of the desired current CALL iboprampfr(rr!, .9, inom!) 'Next ramp to 99% of the desired current at 10% of the ramp rate CALL iboprampfr(.1 * rr!, .9, inom!) 'Now finish the the remaining 1% of the ramp at 1% of the initial ramp rate CALL iboprampfr(.01 * rr!, 1!, inom!) 'Let the power supply and magnet stabilize at the final current SLEEP imagtstableP% END SUB SUB iboprampfr (rr!, fr!, ifin!) '**************************************************************************** 'This subroutine generates a fraction of the magnet current ramp. 'The complete ramp (fr!=1) would be from the present current to ifin!. 'This routine generates a fraction fr! of this ramp. 'The points making up the ramp are updated every 0.1 second. 'This routine can be called several times to approach the final magnet 'current at a low ramp rate. ' 'Input: ' rr!, the magnet current ramp rate ' fr!, the fraction of the ramp to be done from the present current to ifin! ' ifin!, the desired final magnet current ' 'Zachary Wolf '4/18/94, 3/24/95 '**************************************************************************** 'Define a local parameter, the time between ramp steps dt! = .1 'Find the current the Kepco is putting out CALL bit488geti(iini!) 'Compute the number of ramp points to give the ramp rate nr% = (ABS(ifin! - iini!) / rr!) / dt! 'See if we need to ramp IF nr% = 0 THEN EXIT SUB 'Find the size of each current step istep! = (ifin! - iini!) / nr% 'Compute the current at each step DIM iout!(0 TO nr%) FOR i% = 0 TO nr% iout!(i%) = iini! + istep! * i% NEXT i% 'Have the Kepco output fraction fr! of the calculated ramp FOR i% = 0 TO nr% * fr! tstep! = TIMER CALL bit488seti(iout!(i%)) WHILE TIMER - tstep! < dt! WEND NEXT i% END SUB SUB ibopsetpar (imaghpchan%, vtransperimag!, imagtstable%) '**************************************************************************** 'This subroutine sets parameter values for the Kepco power supply. ' 'Input: ' imaghpchan%, HP3457 channel to read the current ' vtransperimag!, transductor voltage per amp ' imagtstable%, settling time of the supply ' 'Zachary Wolf '9/21/95 '**************************************************************************** 'Place the parameters in the local common block for future use imaghpchanP% = imaghpchan% vtransperimagP! = vtransperimag! imagtstableP% = imagtstable% END SUB