Skip to content

make_ctrlvecs.m

Basic Information

  USAGE:  >> make_ctrlvecs

  PURPOSE: Script to construct control vectors for M-matrix in PCS.
        Called from scripts such as
        make_east_ctrlvecs or make_kstar_ctrlvecs.

  INPUTS:  (Defined in workspace prior to calling make_predictors)
     Required:
       objdir = directory containing objects file
       objfile = objects file name (eg kstar_obj_struct.mat)
       tokamak = machine name, eg 'KSTAR', 'EAST', (needed for read_gfile_tok)
    idxcr = PF coil index vector for Rctrlvec
    idxcz = PF coil index vector for Zctrlvec
    idxcip = PF coil index vector for Ipctrlvec
       rrange1 = maj radius range of sub-grid for fields (m) eg [1.5 2]
       zrange1 = vert range of sub-grid for fields (m) eg [-.5 .5]
       iusejphi = 1 = use jphi (all current) region for fields, else ???
       efit_gfile_grid = gfile to use to define grid from jphi if iusejphi=1
    gfile_data = gfile data to use to define grid from jphi
    (Only one of efit_gfile_grid or gfile_data should be specified.)
    rrefk
    zrefk
    Optional:
    separate_figures = set to 1 to get 1 figure per plot, otherwise multiple (default)
    sign_ip = either +1/-1, assuming standard convention for all Ip, PF coils (default 1)
    iconstraint = set to 1 to constrain Ip ctrl vector elements all one sign, else 0 (default)
       ipltbp = 1 to plot Bprobes in plot_geo call (0 to not)
       ipltfl = 1 to plot flux loops in plot_geo call (0 to not)
 USED???
       nprtst = # of princ comp of grid to mag set to use in test
       nsvdz1,2 = # of sing vals to keep in R pred inverse (for P*pred1,2)
       nsvdr1,2 = # of sing vals to keep in R pred inverse
       nsvdi1,2 = # of sing vals to keep in Ip pred inverse
    nsvdk1,2 = # of sing vals to keep in Kappa pred inverse

  OUTPUTS:
    Zctrlvec = Z-ctrl vector (Vpf_Z = Zctrlvec*PID*Zerror)
    Rctrlvec = R-ctrl vector (Vpf_R = Rctrlvec*PID*Zerror)
    Ipctrlvec = Ip-ctrl vector (Vpf_R = Rctrlvec*PID*Zerror)
    (Sign is such that multiplying ctrlvec by positive value => positive change
        in controlled parameter, except kappa which has indeterminate sign.)
    + many  plots evaluating quality of control vectors in producing specified field

  RESTRICTIONS:
     If iusejphi==1, must have efit_gfile_grid defined (which is source of
       jphi on which grid is based if iusejphi=1)

  METHOD:
    Variety of inversions of grid-to-mag objects, linear fits to selected
    data from subgrids, subset of magnetics...

Dependencies