Skip to content
Snippets Groups Projects
Commit 46466c28 authored by Olivier Sauter's avatar Olivier Sauter
Browse files

fix when no EC or no NBI

parent 837312fe
No related branches found
No related tags found
1 merge request!21fix when no EC or no NBI
Pipeline #19545 passed
......@@ -15,14 +15,21 @@ function [ids_ec_antennas,ids_ec_antennas_description,varargout] = tcv_get_ids_e
pow=gdat_tcv(shot,'powers');
if shot>=63000
warning('not sure if set-up correct for new launchers, beams, gyrotrons. Check with O. Sauter')
if isempty(pow.ec.t) || isempty(pow.ec.data) || max(pow.ec.data(:,end))<1e-10
ids_ec_antennas_description.comment = 'no power';
return
end
nb_antennas = 9; % at this stage keep same numbering as standard TCV launchers before mid-2019
nb_antennas = size(pow.ec.data,2)-1; % at this stage keep same numbering as standard TCV launchers before mid-2019
ids_ec_antennas.antenna(1:nb_antennas) = ids_ec_antennas.antenna(1); % copy empty structure for all units, then fill in
ids_ec_antennas_description.comment = ['assume ' num2str(nb_antennas) ' launchers'];
if shot>=63000
warning('not sure if set-up correct for new launchers, beams, gyrotrons. Check with O. Sauter')
% return
end
% $$$ ids_ec_antennas.time = pow.ec.t; if homogeneous time
% $$$ ids_ec_antennas_description.time = 'time from power';
[r_phi0,z_phi0,r1,z1,rc,zc,thetphi_L,thetphi_tor,raysbylauncher,powers,fname,z_axis,launch_params] = ...
......
......@@ -72,11 +72,16 @@ for iunit=1:nb_units
ids_nbi_description.unit{iunit}.energy = ['from \results::' results_subname{iunit} ':energy'];
%% power & current fractions
p_frac=gdat(shot,['\results::' results_subname{iunit} ':fraction']);
ids_nbi.unit{iunit}.beam_power_fraction.data = p_frac.data(:,1:3)*0.01;
ids_nbi.unit{iunit}.beam_power_fraction.time = p_frac.t;
ids_nbi_description.unit{iunit}.beam_power_fraction = ['from \results::' results_subname{iunit} ':fraction'];
i_frac = p_frac.data(:,1:3).*repmat([1 2 3],size(p_frac.data,1),1); % to be compatible with older matlab version .*[1 2 3] not ok
i_frac = i_frac.*1./repmat(sum(i_frac),size(p_frac.data,1),1);
if ~isempty(p_frac.data) && size(p_frac.data,2)>=3
ids_nbi.unit{iunit}.beam_power_fraction.data = p_frac.data(:,1:3)*0.01;
i_frac = p_frac.data(:,1:3).*repmat([1 2 3],size(p_frac.data,1),1); % to be compatible with older matlab version .*[1 2 3] not ok
i_frac = i_frac.*1./repmat(sum(i_frac),size(p_frac.data,1),1);
else
ids_nbi.unit{iunit}.beam_power_fraction.data = p_frac.data;
i_frac = p_frac.data;
end
ids_nbi.unit{iunit}.beam_current_fraction.data = i_frac;
ids_nbi.unit{iunit}.beam_current_fraction.time = p_frac.t;
%% species
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment