Project

General

Profile

Decouple in C++

This is a translation of M. McAteer's Mathematica program skew_fix.nb into C++.

The decouple program takes the LOCO results and spits out files that can be loaded into Booster so that Booster can be decoupled.

This implementation does the following:
  • fixes a bug in skew_fix.nb where the short skew quad currents after 33 ms are displaced by 1 skew quad element.
  • sets all the skew currents to zero at the end of the ramp.

The source code can be downloaded here:

git clone http://cdcvs.fnal.gov/projects/booster_decouple_cpp

Requirements

Builds on MacOSX 10.8.x and LINUX on CLX cluster are supported

The requirements are much less than fitit
but since decouple is useless without fitit, the lesser requirements are not stated here.

Building

Edit the Makefile to put in the appropriate paths if necessary. The Makefile has been set up so that it knows whether it is run on a Mac or on the CLX cluster.

Run

 make

decouple should be created. Move decouple to your local path.

A pre-built version of decouple for MacOSX or CLX LINUX can be requested from the author:

Running

decouple assumes that the same file directory structure as fitit. The file options can be changed in .loco

Checking the configuration

decouple -h

The output should look something like this

decouple version 1.0-3-ga0bf79b-4
decouple version 1.0-7-g7cafd7b-8
config file: /Users/cytan/.loco
command line options and their DEFAULT values
         gnuplot font  = /Library/Fonts/Arial.ttf
         plots dir = ./plots
         common dir = ./common
         results dir = ./results
         magnet settings = MagnetSettings.txt
         machine params vs t = machine_params_vs_t.sdds

generic options :
  -h [ --help ]                         this message
  -t [ --tsq ] arg (=0.0039240000000000004)
                                        TSQ (integrated gradient/amp)
  -r [ --trange ] arg (=3 30)           start and stop time in ms (separated by
                                        a space) for fitting the ramp data
  -c [ --config ] arg (=/Users/cytan/.loco)
                                        LOCO configuration file
  -d [ --debug ]                        enable debugging
  -v [ --version ]                      print version

config file options:
  --fitit.gnufont arg                   gnuplot font
  --fitit.plots_dir arg (=./plots)      plot directory
  --fitit.common_dir arg (=./common)    common directory
  --fitit.results_dir arg (=./results)  results directory
  --fitit.magnet_settings arg (=MagnetSettings.txt)
                                        magnet settings up the ramp file
  --fitit.machine_params_vs_t arg (=machine_params_vs_t.sdds)
                                        machine params vs t results file

Creating NewSQLRamps.txt and NewSQSRamps.txt files and plots

The requirements are that you have the following files:

  • machine_params_vs_t.sdds that was generated by fitit in the results directory.
  • MagnetSettings.txt the Booster ramp file in the common directory.

decouple can be run with plots for the entire ramp

decouple -d

or for a subset of the ramp. For example, from 2.4 ms to 6.9 ms
decouple -d -r 2.4 6.9

The files that are generated are:

  • NewSQLRamps.txt and NewSQSRamps.txt in the results directory.
  • new_rescaled_skew_ramps.png, newdI.png, new_skew_ramps.png and skew_ramp.png in the plots directory.