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

replace ec_antennas by ec_launchers

parent 2ffcccfa
Branches
Tags
1 merge request!33replace ec_antennas by ec_launchers
Pipeline #27934 passed
......@@ -1251,6 +1251,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
assert(~~exist(fname,'file'),'file %s does not exist in %s',fname,ids_empty_path);
ids_empty = eval(fname);
disp(['use structure in .mat file: ' ids_empty_path '/' fname]);
rmpath(ids_empty_path);
catch ME
fprintf('Could not load empty template for %s\n',ids_top_name);
......
......@@ -76,7 +76,7 @@ ids_names=fieldnames(ids2put);
try
ids_full_list = IDS_list;
catch
ids_full_list = {'equilibrium', 'magnetics', 'tf', 'pf_active','wall','core_profiles','ec_antennas','nbi'};
ids_full_list = {'equilibrium', 'magnetics', 'tf', 'pf_active','wall','core_profiles','ec_launchers','nbi'};
warning(['IDS_list not available, quick fix introducing list of ids ready for TCV: ' fprintf('%s ',ids_full_list{:}) char(10)]);
end
ids_names_notok = setdiff(ids_names,ids_full_list);
......
......@@ -11,7 +11,7 @@ function [ids_from_tcv,varargout] = tcv2ids(shot,varargin);
% mdsconnect('localhost:5555')
%
% varargin: 'ids_names': cell, idss to load, by default all defined so far (if empty or empty string or not given)
% {'equilibrium', 'magnetics', 'pf_active','wall','core_profiles','ec_antennas','nbi'} or a subset
% {'equilibrium', 'magnetics', 'pf_active','wall','core_profiles','ec_launchers','nbi'} or a subset
% 'error_bar': type (string)
% empty or 'delta' (default): meaning difference in upper is set (standard error_bar
% 'added': errorbar is added: upper=data+delta and lower=data-delta
......@@ -32,7 +32,7 @@ p = inputParser;
% no required inputs here so one can call with empty args and get defaults parameters
% effectively required inputs should have defaults as empty
p.addOptional('shot', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer
p.addOptional('ids_names', {'equilibrium', 'magnetics', 'pf_active','wall', 'tf','core_profiles','ec_antennas','nbi'}, @(x) isempty(x) || iscell(x) ); % char or cell array
p.addOptional('ids_names', {'equilibrium', 'magnetics', 'pf_active','wall', 'tf','core_profiles','ec_launchers','nbi'}, @(x) isempty(x) || iscell(x) ); % char or cell array
p.addOptional('error_bar', 'delta', @(x) isempty(x) || ischar(x) ); % char or cell array
p.addOptional('cocos_out', 11, @(x) isempty(x) || isnumeric(x) ); % char
p.addOptional('ipsign_out', 0, @(x) isempty(x) || (x==0 | x==-1 | x==+1) ); % char
......
......@@ -9,7 +9,7 @@ function [ids_from_tcv,varargout] = tcv2ids2database(shot,run_out,varargin);
%
% varargin: 'occurence': occurence value
% varargin: 'ids_names': cell, ids to load, by default all defined so far (if empty or empty string or not given)
% {'equilibrium', 'magnetics', 'tf', 'pf_active','wall','core_profiles','ec_antennas','nbi'} or a subset
% {'equilibrium', 'magnetics', 'tf', 'pf_active','wall','core_profiles','ec_launchers','nbi'} or a subset
% varargin: 'error_bar': type (string)
% 'delta' or empty (default): meaning difference in upper is set (standard error_bar
% 'added': errorbar is added: upper=data+delta and lower=data-delta
......@@ -47,7 +47,7 @@ p = inputParser;
p.addOptional('shot', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer
p.addOptional('run_out', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer
p.addOptional('occurence', 0, @(x) isempty(x) || (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer
p.addOptional('ids_names', {'equilibrium', 'magnetics', 'pf_active','wall', 'tf','core_profiles','ec_antennas','nbi'}, @(x) isempty(x) || iscell(x)); % char or cell array
p.addOptional('ids_names', {'equilibrium', 'magnetics', 'pf_active','wall', 'tf','core_profiles','ec_launchers','nbi'}, @(x) isempty(x) || iscell(x)); % char or cell array
p.addOptional('error_bar', 'delta', @(x) isempty(x) || ischar(x) ); % char or cell array
p.addOptional('tree_user', getenv('USER'), @(x) isempty(x) || ischar(x) ); % char
p.addOptional('tree_tokamak', 'tcv', @(x) isempty(x) || ischar(x) ); % char
......@@ -136,5 +136,5 @@ ids_from_tcv.ids_put_status = ids_put_status;
% tic;[TTTp,idsp]=evalc('ids_get(expIdx, ''pf_active'')');toc
% tic;[TTTt,idst]=evalc('ids_get(expIdx, ''tf'')');toc
% tic;[TTTw,idsw]=evalc('ids_get(expIdx, ''wall'')');toc
% tic;[TTTw,idsw]=evalc('ids_get(expIdx, ''ec_antennas'')');toc
% tic;[TTTw,idsw]=evalc('ids_get(expIdx, ''ec_launchers'')');toc
% tic;[TTTw,idsw]=evalc('ids_get(expIdx, ''nbi'')');toc
function [ids_ec_antennas,ids_ec_antennas_description,varargout] = tcv_get_ids_ec_antennas(shot,ids_ec_antennas_empty, gdat_params,varargin);
function [ids_ec_launchers,ids_ec_launchers_description,varargout] = tcv_get_ids_ec_launchers(shot,ids_ec_launchers_empty, gdat_params,varargin);
%
% [ids_ec_antennas,ids_ec_antennas_description,varargout] = tcv_get_ids_ec_antennas(shot,ids_ec_antennas_empty,varargin);
% [ids_ec_launchers,ids_ec_launchers_description,varargout] = tcv_get_ids_ec_launchers(shot,ids_ec_launchers_empty,varargin);
%
%
% gdat_params: gdat_data.gdat_params to get all params passed from original call, in particular error_bar options
%
if exist('gdat_params')
[ids_ec_antennas, params_ec_antennas] = tcv_ids_headpart(shot,ids_ec_antennas_empty,'ec_antennas','homogeneous_time',0, ...
[ids_ec_launchers, params_ec_launchers] = tcv_ids_headpart(shot,ids_ec_launchers_empty,'ec_launchers','homogeneous_time',0, ...
'gdat_params',gdat_params,varargin{:});
else
[ids_ec_antennas, params_ec_antennas] = tcv_ids_headpart(shot,ids_ec_antennas_empty,'ec_antennas','homogeneous_time',0,varargin{:});
[ids_ec_launchers, params_ec_launchers] = tcv_ids_headpart(shot,ids_ec_launchers_empty,'ec_launchers','homogeneous_time',0,varargin{:});
aa=gdat_tcv;
gdat_params = aa.gdat_params; % to get default params
end
......@@ -27,44 +27,43 @@ params_eff.data_request = 'powers';
pow=gdat_tcv(shot,params_eff);
pow_desc = params_eff.data_request;
if isempty(pow.ec.t) || isempty(pow.ec.data) || max(pow.ec.data(:,end))<1e-10
ids_ec_antennas_description.comment = 'no power';
ids_ec_launchers_description.comment = 'no power';
return
end
nb_antennas = size(pow.ec.data,2)-1; % at this stage keep same numbering as standard TCV launchers before mid-2019
nb_launchers = 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'];
ids_ec_launchers.launcher(1:nb_launchers) = ids_ec_launchers.launcher(1); % copy empty structure for all units, then fill in
ids_ec_launchers_description.comment = ['assume ' num2str(nb_launchers) ' 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';
% $$$ ids_ec_launchers.time = pow.ec.t; if homogeneous time
% $$$ ids_ec_launchers_description.time = 'time from power';
[r_phi0,z_phi0,r1,z1,rc,zc,thetphi_L,thetphi_tor,raysbylauncher,powers,fname,z_axis,launch_params] = ...
toray_raygeom_TCV(shot,pow.ec.t(1:10:end));
ids_ec_antennas_description.launch_params = launch_params;
ids_ec_launchers_description.launch_params = launch_params;
for iant=1:nb_antennas
ids_ec_antennas.antenna{iant}.identifier = ['L' num2str(iant)];
for iant=1:nb_launchers
ids_ec_launchers.launcher{iant}.identifier = ['L' num2str(iant)];
switch iant
case {1,4}
ids_ec_antennas.antenna{iant}.name = 'LFS equatorial launcher';
ids_ec_launchers.launcher{iant}.name = 'LFS equatorial launcher';
case {2, 3, 5, 6}
ids_ec_antennas.antenna{iant}.name = 'LFS top launcher';
ids_ec_launchers.launcher{iant}.name = 'LFS top launcher';
otherwise
ids_ec_antennas.antenna{iant}.name = 'TOP launcher';
ids_ec_launchers.launcher{iant}.name = 'TOP launcher';
end
if any(isfinite(pow.ec.data(:,iant)))
ids_ec_antennas.antenna{iant}.power_launched.data = pow.ec.data(:,iant);
ids_ec_antennas.antenna{iant}.power_launched.time = pow.ec.t;
ids_ec_antennas_description.antenna{iant}.power_launched = 'from gdat powers .ec';
ids_ec_antennas_description.antenna{iant}.launching_position = 'from launch_params obtained from toray_raygeom_TCV';
ids_ec_launchers.launcher{iant}.power_launched.data = pow.ec.data(:,iant);
ids_ec_launchers.launcher{iant}.power_launched.time = pow.ec.t;
ids_ec_launchers_description.launcher{iant}.power_launched = 'from gdat powers .ec';
ids_ec_launchers_description.launcher{iant}.launching_position = 'from launch_params obtained from toray_raygeom_TCV';
else
ids_ec_antennas_description.antenna{iant}.power_launched = 'no power for this launcher from gdat powers .ec';
ids_ec_launchers_description.launcher{iant}.power_launched = 'no power for this launcher from gdat powers .ec';
end
if length(launch_params)>=iant && ~isempty(launch_params{iant})
% find 1st non-empty data
......@@ -75,50 +74,51 @@ for iant=1:nb_antennas
end
end
% non time-dependent quantities, take 1st ok values
ids_ec_antennas.antenna{iant}.frequency =launch_params{iant}{it_ok{iant}(1)}.freq;
ids_ec_antennas.antenna{iant}.mode.time = [pow.ec.t(1) pow.ec.t(end)];
ids_ec_antennas.antenna{iant}.mode.data = [-1 -1]; % at this stage assume X mode always, to change when available
ids_ec_launchers.launcher{iant}.frequency.time = [pow.ec.t(1) pow.ec.t(end)];
ids_ec_launchers.launcher{iant}.frequency.data =[launch_params{iant}{it_ok{iant}(1)}.freq launch_params{iant}{it_ok{iant}(end)}.freq];
ids_ec_launchers.launcher{iant}.mode.time = [pow.ec.t(1) pow.ec.t(end)];
ids_ec_launchers.launcher{iant}.mode.data = [-1 -1]; % at this stage assume X mode always, to change when available
for i=1:length(it_ok{iant})
r0 = sqrt(launch_params{iant}{it_ok{iant}(i)}.x0.^2 + launch_params{iant}{it_ok{iant}(i)}.y0.^2) / 100.; % in [m]
time_launch = launch_params{iant}{it_ok{iant}(i)}.time;
ids_ec_antennas.antenna{iant}.launching_position.r.data(i) = r0;
ids_ec_antennas.antenna{iant}.launching_position.z.data(i) = launch_params{iant}{it_ok{iant}(i)}.z0/100.;
ids_ec_antennas.antenna{iant}.launching_position.phi.data(i) = atan2(launch_params{iant}{it_ok{iant}(i)}.y0/100,r0);
ids_ec_antennas.antenna{iant}.launching_position.r.time(i) = time_launch;
ids_ec_antennas.antenna{iant}.launching_position.z.time(i) = time_launch;
ids_ec_antennas.antenna{iant}.launching_position.phi.time(i) = time_launch;
ids_ec_launchers.launcher{iant}.launching_position.r.data(i) = r0;
ids_ec_launchers.launcher{iant}.launching_position.z.data(i) = launch_params{iant}{it_ok{iant}(i)}.z0/100.;
ids_ec_launchers.launcher{iant}.launching_position.phi.data(i) = atan2(launch_params{iant}{it_ok{iant}(i)}.y0/100,r0);
ids_ec_launchers.launcher{iant}.launching_position.r.time(i) = time_launch;
ids_ec_launchers.launcher{iant}.launching_position.z.time(i) = time_launch;
ids_ec_launchers.launcher{iant}.launching_position.phi.time(i) = time_launch;
kz = cos(launch_params{iant}{it_ok{iant}(i)}.theta_toray*pi/180.);
kmr = -sin(launch_params{iant}{it_ok{iant}(i)}.theta_toray*pi/180.).*cos(launch_params{iant}{it_ok{iant}(i)}.phi_toray*pi/180.);
kphi = sin(launch_params{iant}{it_ok{iant}(i)}.theta_toray*pi/180.).*sin(launch_params{iant}{it_ok{iant}(i)}.phi_toray*pi/180.); %*sigma_Rphiz (=+1 for TCV cocos=17)
if (kz==0 && kmr==0)
ids_ec_antennas.antenna{iant}.launching_angle_pol.data(i) = 0.;
ids_ec_launchers.launcher{iant}.steering_angle_pol.data(i) = 0.;
else
ids_ec_antennas.antenna{iant}.launching_angle_pol.data(i) = atan2(-kz,kmr);
ids_ec_launchers.launcher{iant}.steering_angle_pol.data(i) = atan2(-kz,kmr);
end
ids_ec_antennas.antenna{iant}.launching_angle_pol.time(i) = time_launch;
ids_ec_antennas.antenna{iant}.launching_angle_tor.data(i) = asin(kphi);
ids_ec_antennas.antenna{iant}.launching_angle_tor.time(i) = time_launch;
% $$$ ids_ec_antennas.antenna{iant}.beam.spot.size.data(i,1) = 0.023;
% $$$ ids_ec_antennas.antenna{iant}.beam.spot.size.data(i,2) = 0.012;
ids_ec_antennas.antenna{iant}.beam.spot.size.data(1,i) = 0.023;
ids_ec_antennas.antenna{iant}.beam.spot.size.data(2,i) = 0.012;
ids_ec_antennas.antenna{iant}.beam.spot.size.time(i) = time_launch;
ids_ec_antennas.antenna{iant}.beam.spot.angle.data(i) = 0.0;
ids_ec_antennas.antenna{iant}.beam.spot.angle.time(i) = time_launch;
% $$$ ids_ec_antennas.antenna{iant}.beam.phase.curvature.data(i,1) = 1./1.88;
% $$$ ids_ec_antennas.antenna{iant}.beam.phase.curvature.data(i,2) = 1./-0.95; % negative in launch_params...
ids_ec_antennas.antenna{iant}.beam.phase.curvature.data(1,i) = 1./1.88;
ids_ec_antennas.antenna{iant}.beam.phase.curvature.data(2,i) = 1./-0.95; % negative in launch_params...
ids_ec_antennas.antenna{iant}.beam.phase.angle.data(i) = 0.0;
ids_ec_antennas.antenna{iant}.beam.phase.angle.time(i) = time_launch;
ids_ec_antennas.antenna{iant}.beam.phase.curvature.time(i) = time_launch;
ids_ec_launchers.launcher{iant}.steering_angle_pol.time(i) = time_launch;
ids_ec_launchers.launcher{iant}.steering_angle_tor.data(i) = asin(kphi);
ids_ec_launchers.launcher{iant}.steering_angle_tor.time(i) = time_launch;
% $$$ ids_ec_launchers.launcher{iant}.beam.spot.size.data(i,1) = 0.023;
% $$$ ids_ec_launchers.launcher{iant}.beam.spot.size.data(i,2) = 0.012;
ids_ec_launchers.launcher{iant}.beam.spot.size.data(1,i) = 0.023;
ids_ec_launchers.launcher{iant}.beam.spot.size.data(2,i) = 0.012;
ids_ec_launchers.launcher{iant}.beam.spot.size.time(i) = time_launch;
ids_ec_launchers.launcher{iant}.beam.spot.angle.data(i) = 0.0;
ids_ec_launchers.launcher{iant}.beam.spot.angle.time(i) = time_launch;
% $$$ ids_ec_launchers.launcher{iant}.beam.phase.curvature.data(i,1) = 1./1.88;
% $$$ ids_ec_launchers.launcher{iant}.beam.phase.curvature.data(i,2) = 1./-0.95; % negative in launch_params...
ids_ec_launchers.launcher{iant}.beam.phase.curvature.data(1,i) = 1./1.88;
ids_ec_launchers.launcher{iant}.beam.phase.curvature.data(2,i) = 1./-0.95; % negative in launch_params...
ids_ec_launchers.launcher{iant}.beam.phase.angle.data(i) = 0.0;
ids_ec_launchers.launcher{iant}.beam.phase.angle.time(i) = time_launch;
ids_ec_launchers.launcher{iant}.beam.phase.curvature.time(i) = time_launch;
end
end
end
% cocos automatic transform
if exist('ids_generic_cocos_nodes_transformation_symbolic') == 2
[ids_ec_antennas,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(ids_ec_antennas,'ec_antennas',gdat_params.cocos_in, ...
[ids_ec_launchers,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(ids_ec_launchers,'ec_launchers',gdat_params.cocos_in, ...
gdat_params.cocos_out,gdat_params.ipsign_out,gdat_params.b0sign_out,gdat_params.ipsign_in,gdat_params.b0sign_in, ...
gdat_params.error_bar,gdat_params.nverbose);
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment