#!/usr/local/bin/perl5 # This script is made to remove the remanent magnetic field from the dipole magnet at the `PITZ` # by S.v.Coelln , made during the summerstudentprogramm 2002 at the DESY Zeuthen # modified by Bert Schoeneich, 20.12.2007, 10:30 for CTS.DIPOLE # values for CTS at 14.01.2008 from Juliane Roensch # [PART 1] - list of params $T=15 ; # time of one periode in seconds $min=0.005 ; # value when the mainloops ends (Ampere) $startcurrent=3.0 ; # current which to start with (Ampere) $invdamp=25 ; # inverse damp factor for the exp-function (increasing this results in decreasing damp) $pi=3.1413 ; # [PART 2] - Calculation of the whole time which is needed to process the script $zeit=-$invdamp*log($min/$startcurrent) ; print "Processing time:".(int($zeit)+5).`\n` ; # 5 seconds of sleep plus 1 sec for rounding integer = 6 $testcurrent=$startcurrent ; # [PART 3] - setting the startcurrents for the Dipole system "doocsput -c PITZ.CA/MAGNETS/CTS.DIPOLE/SETPOINT -t 2 -d $startcurrent" ; # set the current for the dipole system "sleep 3" ; # give time for reaching stationary state # [PART 4] - the main loop for($i=0 ; $testcurrent>$min ; $i++) { $testcurrent=$startcurrent*exp(-$i/$invdamp) ; #just the damped term which is used for aborting loop $current=$testcurrent*cos(2*$pi*$i/$T); # values of the damped cosine oszilation system "doocsput -c PITZ.CA/MAGNETS/CTS.DIPOLE/SETPOINT -t 2 -d $current" ; system "sleep 1" ; } # [PART 5] - decrease the current to the minus ten"th of the last value $endcurrent=-0.5*($current) ; system "doocsput -c PITZ.CA/MAGNETS/CTS.DIPOLE/SETPOINT -t 2 -d $endcurrent" ; system "sleep 1" ; # Set current to zero system "doocsput -c PITZ.CA/MAGNETS/CTS.DIPOLE/SETPOINT -t 2 -d 0" ;