diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index 86f44612d5544a00dc21f874ff79bbc4ed0a5dc3..0b760d6a7a470cfe84d295bd737ba4b171e87a30 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -1,4 +1,4 @@ -function [gdat_data,gdat_params,error_status,varargout] = gdat_tcv(shot,data_request,varargin) +function [gdat_data,gdat_params,error_status,varargout] = gdat_tcv_OS(shot,data_request,varargin) % % function [gdat_data,gdat_params,error_status,varargout] = gdat(shot,data_request,varargin) % @@ -2466,6 +2466,9 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') % if any(strmatch('nbi1',gdat_data.gdat_params.source)) nodenameeff = '\results::NBH:POWR_TCV'; + if shot<70811 + nodenameeff = '\results::NBH:POWR_TCV'; + end nbh_data_tdi = tdi(nodenameeff); if ~isempty(nbh_data_tdi.data) && ~ischar(nbh_data_tdi.data) && ~isempty(nbh_data_tdi.dim) nbi_neutral_power_tot = nbh_data_tdi.data.*1e6; % in W @@ -2489,6 +2492,20 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.data(:,end+1) = interpos(-21,gdat_data.nbi1.t(ij),gdat_data.nbi1.data(ij),gdat_data.t); gdat_data.x(end+1) = size(gdat_data.data,2); gdat_data.label{end+1}=gdat_data.nbi1.label; + else + if gdat_params.nverbose>=3 + fprintf('No NB1 data in MDS+ nodes for shot %i\n', shot); + model_signame = '\ATLAS::NB1.DATA.MODEL:POWR_NEUTRAL'; + if shot<70811 + nodenameeff = '\ATLAS::NB1.DATA.MODEL:POWR_NEUTRAL'; + end + model_data=tdi(model_signame); + if isempty(model_data.dim) + fprintf('And it was NOT requested \n'); + else + fprintf('And it was requested. Check if plasma was a blip or if NB1 did not work \n'); + end + end end end % @@ -2517,10 +2534,10 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') end % if any(strmatch('nbi2',gdat_data.gdat_params.source)) - % NB2 - nodenameeff = '\results::NB2:POWR_TCV'; + % NB2 + nodenameeff = '\results::NB2:POWR_TCV'; nb2_data_tdi = tdi(nodenameeff); - if ~isempty(nb2_data_tdi.data) && ~ischar(nb2_data_tdi.data) && ~isempty(nb2_data_tdi.dim) + if ~isempty(nb2_data_tdi.dim) && ~ischar(nb2_data_tdi.data) && ~isempty(nb2_data_tdi.dim) nbi_neutral_power_tot = nb2_data_tdi.data.*1e6; % in W ij = nbi_neutral_power_tot<100; nbi_neutral_power_tot(ij) = 0.; @@ -2542,8 +2559,20 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.data(:,end+1) = interpos(-21,gdat_data.nbi2.t(ij),gdat_data.nbi2.data(ij),gdat_data.t); gdat_data.x(end+1) = size(gdat_data.data,2); gdat_data.label{end+1}=gdat_data.nbi2.label; + else + if gdat_params.nverbose>=3 + fprintf('No NB2 data in MDS+ nodes for shot %i\n', shot); + model_signame = '\ATLAS::NB2.DATA.MODEL:POWR_NEUTRAL'; + model_data=tdi(model_signame); + if isempty(model_data.dim) + fprintf('And it was NOT requested \n'); + else + fprintf('And it was requested. Check if plasma was a blip or if NB1 did not work \n'); + end + end end end + if any(strmatch('dnbi',gdat_data.gdat_params.source)) % NB2 nodenameeff = '\RESULTS::DNBI:POWR_TCV'; @@ -3286,7 +3315,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.x = [1:size(sig,1)]; gdat_data.dimunits = {'20 chords per camera'; 's'}; else - keyboard + % keyboard % extract only given channels gdat_data.data = sig(channel_xtomo,:); gdat_data.x = channel_xtomo; diff --git a/matlab/TCV_IMAS/tcv_get_ids_nbi.m b/matlab/TCV_IMAS/tcv_get_ids_nbi.m index 3542cfb7502a2e949f56a63ce0ea65d6644b76a3..eb6777a57379ad39f8a123d920802c65c8fca11e 100644 --- a/matlab/TCV_IMAS/tcv_get_ids_nbi.m +++ b/matlab/TCV_IMAS/tcv_get_ids_nbi.m @@ -23,45 +23,59 @@ ids_nbi_description=''; % -nb_units = 2; % assume 2 units: 1st NBH and DNBI +nb_units = 3; % assume 2 units: 1st NBH and DNBI ids_nbi.unit(1:nb_units) = ids_nbi.unit(1); % copy empty structure for all units, then fill in % create lists of what is different for each units so that can scan through units -unit_identifier = {'NBH1', 'DNBI'}; -unit_name = {'25keV 1st NBH source', 'diagnostic NBI'}; -results_subname = {'nbh', 'dnbi'}; -species.a = [2., 1.]; -species.z_n = [1., 1.]; -species.label = {'D', 'H'}; -beamlets_group.direction = [-1, 1]; -beamlets_group.tangency_radius = [736, 235.3]*1e-3; -beamlets_group.angle = [0., 0.]; -beamlets_group.width_horizontal = [250, 87.2]*1e-3; -beamlets_group.width_vertical = [250, 87.2]*1e-3; +unit_identifier = {'NB1', 'NB2', 'DNBI'}; +unit_name = {'25keV 1st NBH source', '50keV 2nd NBH source', 'diagnostic NBI'}; +results_subname = {'nb1', 'nb2', 'dnbi'}; +if shot<70811 + results_subname = {'nbh', 'nb2', 'dnbi'}; +end +species.a = [2., 2., 1.]; +species.z_n = [1., 1., 1.]; +species.label = {'D', 'D','H'}; +beamlets_group.direction = [-1, 1, 1]; +beamlets_group.tangency_radius = [736, 736, 235.3]*1e-3; +beamlets_group.angle = [0., 0., 0.]; +beamlets_group.width_horizontal = [250, 250, 87.2]*1e-3; +beamlets_group.width_vertical = [250, 250, 87.2]*1e-3; beamlets_group.focus(1:nb_units)=struct('focal_length_horizontal',[],'focal_length_vertical',[],'width_min_horizontal',[],'width_min_vertical',[]); beamlets_group.focus(1).focal_length_horizontal = 3.76; beamlets_group.focus(1).focal_length_vertical = 3.98; beamlets_group.focus(1).width_min_horizontal = 21.6*1e-2; beamlets_group.focus(1).width_min_vertical = 9.4*1e-2; -beamlets_group.focus(2).focal_length_horizontal = 1.8; -beamlets_group.focus(2).focal_length_vertical = 1.8; -beamlets_group.focus(2).width_min_horizontal = 12.1*1e-2; -beamlets_group.focus(2).width_min_vertical = 12.1*1e-2; +% So far NB2 parameters are merely a copy of NB1 parameters +beamlets_group.focus(2).focal_length_horizontal = 3.76; +beamlets_group.focus(2).focal_length_vertical = 3.98; +beamlets_group.focus(2).width_min_horizontal = 21.6*1e-2; +beamlets_group.focus(2).width_min_vertical = 9.4*1e-2; +beamlets_group.focus(3).focal_length_horizontal = 1.8; +beamlets_group.focus(3).focal_length_vertical = 1.8; +beamlets_group.focus(3).width_min_horizontal = 12.1*1e-2; +beamlets_group.focus(3).width_min_vertical = 12.1*1e-2; beamlets_group.divergence(1:nb_units) = struct('particle_fraction',[],'vertical',[],'horizontal',[]); beamlets_group.divergence(1).particle_fraction = 1.; beamlets_group.divergence(1).vertical = 0.59 *pi/180.; beamlets_group.divergence(1).horizontal = 1.4 *pi/180.; beamlets_group.divergence(2).particle_fraction = 1.; -beamlets_group.divergence(2).vertical = 0.53 *pi/180.; -beamlets_group.divergence(2).horizontal = 0.53 *pi/180.; +beamlets_group.divergence(2).vertical = 0.59 *pi/180.; +beamlets_group.divergence(2).horizontal = 1.4 *pi/180.; +beamlets_group.divergence(3).particle_fraction = 1.; +beamlets_group.divergence(3).vertical = 0.53 *pi/180.; +beamlets_group.divergence(3).horizontal = 0.53 *pi/180.; %dcd_NBH = psitbxdcd(4.5889, 0.0, 211.9535*pi/180, 0.0, -9.2308*pi/180); beamlets_group.position(1:nb_units) = struct('phi',[],'r',[],'z',[]); beamlets_group.position(1).phi = 211.9535*pi/180.; beamlets_group.position(1).r = 4.5889; beamlets_group.position(1).z = 0.; +beamlets_group.position(2).phi = 58.8255*pi/180.; +beamlets_group.position(2).r = 4.5889; +beamlets_group.position(2).z = 0.; beamlets_group.position(2).phi = 295.2416*pi/180.; beamlets_group.position(2).r = 4.9274; beamlets_group.position(2).z = 0.; @@ -73,6 +87,9 @@ for iunit=1:nb_units %% power params_eff.data_request = ['\results::' results_subname{iunit} ':powr_tcv']; pow=gdat_tcv(shot,params_eff); + if ischar(pow.data) + pow.data=0; + end ids_nbi.unit{iunit}.power_launched.data = pow.data*1e6; ids_nbi.unit{iunit}.power_launched.time = pow.t; ids_nbi_description.unit{iunit}.power_launched = params_eff.data_request;