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

add to have ohm even if no ec and same struct empty for powers ne and te if no data

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@5136 d63d8f72-b253-0410-a779-e742ad2e26cf
parent 1e63b60b
No related branches found
No related tags found
No related merge requests found
...@@ -279,7 +279,7 @@ if do_mdsopen_mdsclose ...@@ -279,7 +279,7 @@ if do_mdsopen_mdsclose
else else
ishot = mdsopen(shot); % if ishot equal to shot, then mdsclose at the end ishot = mdsopen(shot); % if ishot equal to shot, then mdsclose at the end
end end
if ishot~=shot if isempty(ishot) || ishot~=shot
if gdat_params.nverbose>=1; warning(['cannot open shot= ' num2str(shot)]); end if gdat_params.nverbose>=1; warning(['cannot open shot= ' num2str(shot)]); end
return return
end end
...@@ -1049,34 +1049,61 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') ...@@ -1049,34 +1049,61 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
case {'powers'} case {'powers'}
% note: same time array for all main, ec, ohm, nbi, ... % note: same time array for all main, ec, ohm, nbi, ...
% At this stage fill just ech, later add nbi % At this stage fill just ech, later add nbi
% EC
nodenameeff='\results::toray.input:p_gyro'; nodenameeff='\results::toray.input:p_gyro';
tracetdi=tdi(nodenameeff); tracetdi=tdi(nodenameeff);
if isempty(tracetdi.data) || isempty(tracetdi.dim) % || ischar(tracetdi.data) (to add?) if isempty(tracetdi.data) || isempty(tracetdi.dim) % || ischar(tracetdi.data) (to add?)
if (gdat_params.nverbose>=1); warning(['problems loading data for ' nodenameeff ' for data_request= ' data_request_eff]); end if (gdat_params.nverbose>=1); warning(['problems loading data for ' nodenameeff ' for data_request= ' data_request_eff]); end
return gdat_data.ec.data = [];
end gdat_data.ec.units = [];
gdat_data.ec.data = tracetdi.data*1e3; % at this stage p_gyro is in kW' gdat_data.ec.dim=[];
gdat_data.ec.units = 'W'; gdat_data.ec.dimunits=[];
gdat_data.ec.dim=tracetdi.dim; gdat_data.ec.t=[];
gdat_data.ec.dimunits=tracetdi.dimunits; gdat_data.ec.x=[];
gdat_data.ec.t=tracetdi.dim{1}; gdat_data.ec.data_fullpath=[];
gdat_data.ec.x=tracetdi.dim{2}; gdat_data.ec.label='';
gdat_data.ec.data_fullpath=[nodenameeff]; else
gdat_data.ec.label='P_{EC}'; gdat_data.ec.data = tracetdi.data*1e3; % at this stage p_gyro is in kW'
% set ec time as reference gdat_data.ec.units = 'W';
gdat_data.t = gdat_data.ec.t; gdat_data.ec.dim=tracetdi.dim;
gdat_data.dim{1} = gdat_data.t; gdat_data.ec.dimunits=tracetdi.dimunits;
gdat_data.dimunits{1} = 's'; gdat_data.ec.t=tracetdi.dim{1};
gdat_data.units = 'W'; gdat_data.ec.x=tracetdi.dim{2};
gdat_data.ec.data_fullpath=[nodenameeff];
gdat_data.ec.label='P_{EC}';
% set ec time as reference
gdat_data.t = gdat_data.ec.t;
gdat_data.dim{1} = gdat_data.t;
gdat_data.dimunits{1} = 's';
gdat_data.units = 'W';
end
% Ohmic
gdat_data.ohm.data = [];
gdat_data.ohm.units = '';
gdat_data.ohm.dim=gdat_data.dim;
gdat_data.ohm.dimunits=gdat_data.dimunits;
gdat_data.ohm.t=[];
gdat_data.ohm.x=[];
gdat_data.ohm.data_fullpath=[];
gdat_data.ohm.label='';
% get ohmic power simply from vloop*Ip (minus sign for TCV) % get ohmic power simply from vloop*Ip (minus sign for TCV)
ip=gdat([],'ip'); ip=gdat([],'ip');
vloop=gdat([],'vloop'); vloop=gdat([],'vloop');
tension = -1e5; tension = -1e5;
vloop_smooth=interpos(vloop.t,vloop.data,gdat_data.t,tension); if isempty(gdat_data.t)
ip_t = interp1(ip.t,ip.data,gdat_data.t); gdat_data.t = vloop.t;
gdat_data.ohm.data = -vloop_smooth.*ip_t; gdat_data.dim{1} = gdat_data.t;
gdat_data.ohm.units = 'W'; gdat_data.ohm.data = vloop.data;
gdat_data.dimunits{1} = 's';
gdat_data.units = 'W';
else
vloop_smooth=interpos(vloop.t,vloop.data,gdat_data.t,tension);
ip_t = interp1(ip.t,ip.data,gdat_data.t);
gdat_data.ohm.data = -vloop_smooth.*ip_t;
end
gdat_data.ohm.units = gdat_data.units;
gdat_data.ohm.dim=gdat_data.dim; gdat_data.ohm.dim=gdat_data.dim;
gdat_data.ohm.dimunits=gdat_data.dimunits; gdat_data.ohm.dimunits=gdat_data.dimunits;
gdat_data.ohm.t=gdat_data.t; gdat_data.ohm.t=gdat_data.t;
...@@ -1086,12 +1113,19 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') ...@@ -1086,12 +1113,19 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
% total power from each and total % total power from each and total
gdat_data.data(:,1) = gdat_data.ohm.data; gdat_data.data(:,1) = gdat_data.ohm.data;
gdat_data.data(:,2) = gdat_data.ec.data(:,10); if ~isempty(gdat_data.ec.data)
gdat_data.data(:,3) = gdat_data.ec.data(:,10) + gdat_data.ohm.data; gdat_data.data(:,2) = gdat_data.ec.data(:,10);
gdat_data.dim{2} = [1:3]; gdat_data.data(:,3) = gdat_data.ec.data(:,10) + gdat_data.ohm.data;
gdat_data.dimunits{2} = 'Pohm;Pec;Ptot'; gdat_data.dim{2} = [1:3];
gdat_data.data_fullpath=['tot power from EC and ohm']; gdat_data.dimunits{2} = 'Pohm;Pec;Ptot';
gdat_data.label = 'P_{ohm};P_{EC};P_{tot}'; gdat_data.data_fullpath=['tot power from EC and ohm'];
gdat_data.label = 'P_{ohm};P_{EC};P_{tot}';
else
gdat_data.dim{2} = [1];
gdat_data.dimunits{2} = 'Pohm=Ptot';
gdat_data.data_fullpath=['tot power from ohm'];
gdat_data.label = 'P_{tot}=P_{ohm}';
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case {'q_rho'} case {'q_rho'}
...@@ -1539,6 +1573,14 @@ function [gdat_data] = get_thomson_raw_data(shot,data_request_eff,gdat_data,doed ...@@ -1539,6 +1573,14 @@ function [gdat_data] = get_thomson_raw_data(shot,data_request_eff,gdat_data,doed
try try
time=mdsdata('\results::thomson:times'); time=mdsdata('\results::thomson:times');
catch catch
gdat_data.error_bar = [];
if strcmp(data_request_eff(1:2),'ne')
tracefirrat_data = [];
gdat_data.firrat=tracefirrat_data;
gdat_data.data_raw = gdat_data.data;
gdat_data.error_bar_raw = gdat_data.error_bar;
end
if (nverbose>=1) && shot<100000 if (nverbose>=1) && shot<100000
warning('Problems with \results::thomson:times') warning('Problems with \results::thomson:times')
warning(['!!!!!!!!!!!!!!!!!!!!!!!!! cannot continue with ' data_request_eff]) warning(['!!!!!!!!!!!!!!!!!!!!!!!!! cannot continue with ' data_request_eff])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment