Skip to content

make_scenario.m

Basic Information

  SYNTAX: [Ictraj_PCS,Vtraj_PCS] = make_scenario(scenario_data,debug)

  PURPOSE:  Make the input files needed by PCS and simserver to run a
    particular plasma scenario simulation.
    (Only works for EAST and KSTAR right now.)

  INPUT:
  in scenario_data structure:
    scenario_name = name(string) of scenario to build setup files for
    tok_system = tokamak (and plasma) model structure
    vacuum_objs = tokamak basic geometry objects structure
    IPCS_to_Istates = index vector mapping coils in PCS order to states
        of the linearized model, IPCS_to_Istates(i) = k, where i is the
        number of the PF coil, and k is the corresponding state index
        (include only coils intended to have nonzero equil. current)
    Istates_to_IPCS = index vector mapping coil current states to coils
        in PCS, Istates_to_IPCS(i) = k, where i is the index of the
        state, and k is the number of the PF coil
    Ipref   = trajectory for plasma current (1st column=time, 2nd=Ip)
    Icref   = trajectory for coil currents, 1st col.=time, remaining columns
              are PF currents in PCS order (required for vacuum, else not used)
    PF_state_names_PCS = names of PF current states, in PCS order
    PFmax   = vector maximum currents allowed in PF coils
    iplcirc = set equal to 1 to include plasma circuit eqn in model
    cccirc = coil connection definitions
    pfcoils = subset of PF coils to compute trajectories for = either indices
         into vacuum_objs.fcnames or names in vacuum_objs.fcnames
    vacuum_model = flag, 0=vacuum model in tok_system, 1=plasma model
    ip_init  = initial value for Ip
    dt_rz      = time step for R and Z feedback control
    Gp_z,Gd_z,Gi_z = gains for Z control
    taup_z,taud_z,taui_z = time constants for Z control
    full_system  = set to 1 to get full set of outputs, else 0
    Vlimits = upper and lower bounds on coil voltages
    idx_vcntl_ckts = indices of vert. cntrl coils, after circuits connected
  debug = set to 1 to get debug plots of trajectories

  OUTPUT:
    Ictraj_PCS
    Vctraj_PCS
   FILES (all with scenario_name in place of #):
    #.log = log showing what is produced and how to use
    #_PF*_Itraj.dat = PF and Ip trajectories (consistent with Ip trajectory)
    #_Ip_traj.dat = Ip trajectory
    #_Vtraj.dat  = voltage trajectories
    #_PCS_mutuals.dat = matrices needed by PCS to compute V trajs
    #_I_init.dat = file to use to initialize simserver currents
              at other than default (equilibrium) values

  RESTRICTIONS:
  (1) Assumes that first 3 sets of diagnostics are: coils, flux loops, probes
  (2) Works only when ohmic distribution currents all the same sign right now.

Dependencies