#!/bin/bash # to run do: bash BP_scan.sh # prerequisites: # - setup_env.sh souced # - the hostname is set # - detector is on # - Filename_creator has been run (with correct module #) # - source pccalib.sh with pc (pc-jungfrau-01/pc-jungfrau-test/pc-jungfrau-02) # - waveform generator is on # - amplifier board is powered and unconnected. # - last file should be 2097184000 bytes big. # connect to pc10773 (RH7 machine connected to the pulser and, after klog, run the command # nc -k -n -v -l -p 5555 -e /bin/bash # last data file (000002.dat) should be 2097184000 bytes KILLRCV="killall ju_udp_receiver_3threads_2_0" $KILLRCV sls_detector_put stop #just in case sls_detector_put powerchip 1 sls_detector_put delay 0 sls_detector_put triggers 1 sls_detector_put frames 100 sls_detector_put period 0.005 sls_detector_put exptime 0.00004 sls_detector_put highvoltage 0 # configure for receiver on pc-jungfrau-01/pc-jungfrau-test/pc-jungfrau-02 # source pccalib.sh with pc (pc-jungfrau-01/pc-jungfrau-test/pc-jungfrau-02) sls_detector_put udp_dstport 32410 sls_detector_put udp_dstip $DSTIP #10.1.4.105 sls_detector_put udp_dstmac $DSTMAC #3C:FD:FE:A2:14:D8 sls_detector_put udp_srcip $SRCIP #10.1.4.9 sls_detector_put udp_srcmac 00:ab:be:cc:dd:e2 #sls_detector_put configuremac 0 sls_detector_put readoutspeed half_speed #sls_detector_put readoutspeed full_speed sls_detector_put gainmode dynamic CLI=/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay # prepare the AGILENT 33250A echo $CLI" OUTP OFF " | nc pc10773 5555 sleep 0.2 #remember to put High-Z load! #Change load to Infinity echo $CLI" OUTP:LOAD INF " | nc pc10773 5555 # Polarity normal echo $CLI" OUTP:POL NORM" | nc pc10773 5555 # pulse echo $CLI" FUNC PULS" | nc pc10773 5555 sleep 0.2 # frequency 1kHz echo $CLI" FREQ 1000" | nc pc10773 5555 sleep 0.2 # width 40 us echo $CLI" PULS:WIDT 0.000040" | nc pc10773 5555 sleep 0.2 # amplitude 0.1 V" | nc pc10773 5555 echo $CLI" VOLT 0.1" | nc pc10773 5555 # offset 0 V echo $CLI" VOLT:OFFS 0" | nc pc8830 5555 sleep 0.2 # VLOW 0 V echo $CLI" VOLT:LOW 0" | nc pc10773 5555 sleep 0.2 # edge 50 ns echo $CLI" PULS:TRAN 0.000000050" | nc pc10773 5555 sleep 0.2 # triggered burst echo $CLI" BURS:MODE TRIG" | nc pc10773 5555 sleep 0.2 # cycles 1 echo $CLI" BURS:NCYC 1" | nc pc10773 5555 sleep 0.2 # external trigger source echo $CLI" TRIG:SOUR EXT" | nc pc10773 5555 sleep 0.2 # delay 1 us echo $CLI" TRIG:DEL 0.000001" | nc pc10773 5555 # delay 40 us #echo $CLI" TRIG:DEL 0.000040" | nc pc10773 5555 sleep 0.2 # slope positive echo $CLI" TRIG:SLOP POS" | nc pc10773 5555 sleep 0.2 # turn on burst mode echo $CLI" BURS:STAT ON" | nc pc10773 5555 sleep 0.2 if [ "$1" == 'Y' ]; then echo "started with Y argument, skipping manual checks" else echo "It is now safe to connect the cable between the amplifier board and the readout board" echo "Please do so and press any key to continue, or press q to exit this script" read -n 1 -s input if [[ $input = "q" ]]; then echo "Exiting script" exit 1 fi fi # high voltage # sls_detector_put highvoltage 200 #because it seemed more stable, we are using external HV 230V # output on echo $CLI" OUTP ON" | nc pc10773 5555 sleep 0.2 if [ "$1" == 'Y' ]; then echo "started with Y argument, skipping manual checks" else echo "The current on the amplifier board should be ~0.035 A" echo "Please check and press any key to continue, or press q to exit this script" read -n 1 -s input if [[ $input = "q" ]]; then echo "Exiting script" exit 1 fi fi $TKBPG0 & # the scan for ivpulse in {10..1000..10} do vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l)) echo $CLI" VOLT:HIGH "$vpulse | nc pc10773 5555 sleep 1 sls_detector_put start sleep 1 done for ivpulse in {1050..6000..50} do vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l)) echo $CLI" VOLT:HIGH "$vpulse | nc pc10773 5555 sleep 1 sls_detector_put start sleep 1 done # high voltage # sls_detector_put highvoltage 0 # output off echo $CLI" OUTP OFF " | nc pc10773 5555 $KILLRCV echo "Finished scan, please wait for capacitor to discharge" sleep 20 echo "It is now safe to disconnect the cable between the amplifier board and the readout board" echo "Script finished"