compare_vacuum_fresp.m
SYNTAX: compare_vacuum_fresp
PURPOSE: Use in analyzing sine-wave excitation data collected for model validation.
Perform generic build of single-input system model, then compare frequency response of
that model with frequency response data calculated from acquired experiment data.
INPUT:
tokamak = name of tokamak (e.g. 'd3d', 'kstar', 'nstx', ...)
config_name = string specifying which model configuration to use
model_type = type of model to generate: 0=voltage input, 1=current input
fresp_data_input = array of structures, each structure containing data for response to 1 input:
input_index = value depends on model_type:
if 0, set to index of model input that is connected to a power supply during experiment
if 1, must be set to 1
sin_shots = single shot number or vector of shot numbers, one for each interval defined below
t_intervals = array of pairs [ [tstart(1), tend(1)]; [tstart(2), tend(2)]; ... ] defining time intervals
containing sine wave data (of a single frequency) to be analyzed
f_intervals = array of pairs [fmin,fmax] = intervals in frequency (Hz) to search for sine wave frequency
dc_shot = shot number containing data from which to compute dc gain
dc_interval = time interval [tstart, tend] (containing ~constant data) to use for dc gain calculation
get_data_fn_input = string defining function to call when fetching input signals
get_data_fn_output = string defining function to call when fetching output signals
cccirc = vector defining coil connections (see help build_tokamak_system)
OR (not both)
netlist = netlist input defining coil connections (see help build_tokamak_system)
PLUS, add any other parameters that build_<device>_sys needs to execute
OPTIONAL INPUTS:
output_set = column number in the tok_system.output_signals array to use to define output signals (default 1)
output_index = indices of model outputs to compare model and data or 'all' (default 'all')
model_type = 0 for voltage input, or 1 for current input (default 0)
drift_correct = vector [tmin1,tmax1] or [tmin1,tmax1,tmin2,tmax2] defining times to compute offset(s)
needed to correct for integrator drift; 2 times=>offset only, 4 times=>correct linear drift
freq_vals = interval of frequency values (Hz) to include in modeled frequency response plots
(default is defined to cover experiment data frequency responses)
show_plots = set >= 1 to see plots during calculation of frequency response (default 0), larger => more info
verbose = set to value greater than 0 to get diagnostic prints, larger value gives more info
save_response = set to 1 to save frequency response in file named <coil>_fresp.mat (default 0)
snr_reject_thresh = reject calculated frequency response if output SNR (dB) < this value (default 20)
snr_accept_thresh = automatically accept calculated response f output SNR (dB) > this value (default 26)
sin_offset_intvals
dc_offset_intvals
min_ncounts = minimum number of digitizer counts required in dynamic range of data; if an output signal
has less dynamic range than this value, the response data for that signal is ignored (default 7)
create_plotfile = set to 1 to create postscript file containing all frequency response plots (default 0)
OUTPUT: comparison plots for model frequency response versus gain/phase computed from experimental data.
RESTRICTIONS: Currently only models correctly those outputs without direct feedthrough (i.e. with
D=0 in plant model) when model_type = 1. Also, the netlist input option does not work correctly yet.
Dependencies