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

fix pf_active add some error

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11985 d63d8f72-b253-0410-a779-e742ad2e26cf
parent d375921c
No related branches found
No related tags found
No related merge requests found
......@@ -17,14 +17,14 @@ if exist('gdat_params') && isfield(gdat_params,'error_bar') && ~isempty(gdat_par
error_bar = gdat_params.error_bar;
end
% Coils that can be characterized by R, Z and a
% crosssectional area are described as distinct coils with a single element, this also corresponds to coils with distinct TCV names).
% Elements can be used in the future to refine the spatial
% description of each coil.
% The circular conductor of G-coils approximated by a square of equal
% Coils that can be characterized by R, Z and a
% crosssectional area are described as distinct coils with a single element, this also corresponds to coils with distinct TCV names).
% Elements can be used in the future to refine the spatial
% description of each coil.
% The circular conductor of G-coils approximated by a square of equal
% crosssectional area.
% Each coil has a positive turnsign. The return current in T_003 is
% dealt with in the circuit description and in the machine mapping.
% Each coil has a positive turnsign. The return current in T_003 is
% dealt with in the circuit description and in the machine mapping.
% In practice the dissipated energy in the pf '
% coils is not a relevant limit.
mdsopen(shot)
......@@ -47,7 +47,7 @@ nt_c = mdsvalue('static(''nt_c'')'); % number of turns
xsect_c = mdsvalue('static(''xsect_c'')');
res_c = mdsvalue('static(''res_c'')'); % resistence of the coil
sizepfc = numel(r_c);
namepfc = mdsvalue('dim_of(_r_c)');
namepfc = mdsvalue('dim_of(_r_c)');
% Set effective turns in T1 and T2 (see J.-M. Moret, et al., RSI 69 (1998) 2333)
iT = strmatch('T_001',namepfc);
......@@ -68,7 +68,7 @@ ids_struct_out(1:sizepfc) = ids_structures;
ind_coil_ids = 0;
for ii=1:ncircuits2ids
ncoil2ids = numel(coil_names2ids{ii}); % number of coils for a given circuit
for jj = 1:ncoil2ids
ind_coil_ids = ind_coil_ids +1;
ids_struct_out{ind_coil_ids}.name = coil_names2ids{ii}{jj};
......@@ -76,10 +76,10 @@ for ii=1:ncircuits2ids
tmpdata = tdi(mds_paths2ids{ii});
ids_struct_out{ind_coil_ids}.current.data = tmpdata.data;
ids_struct_out_description{ind_coil_ids}.current.data = ['from ' mds_paths2ids{ii}];
ids_struct_out{ind_coil_ids}.current.time = tmpdata.dim{1};
ids_struct_out{ind_coil_ids}.current.time = tmpdata.dim{1};
% Find index on static tree
tmpind = find(strcmp(ids_struct_out{ii}.name, namepfc));
tmpind = find(strcmp(ids_struct_out{ind_coil_ids}.name, namepfc));
ids_struct_out{ind_coil_ids}.element{1}.geometry.rectangle.r = r_c(tmpind);
ids_struct_out_description{ind_coil_ids}.element{1}.geometry.rectangle_r = ['from static(''r_c'')'];
ids_struct_out{ind_coil_ids}.element{1}.geometry.rectangle.z = z_c(tmpind);
......@@ -102,6 +102,7 @@ switch error_bar
for ii=1:ncircuits2ids
ncoil2ids = numel(coil_names2ids{ii}); % number of coils for a given circuit
for jj = 1:ncoil2ids
fixed_error = pf_def.coil_current_error{ii}(jj);
ind_coil_ids = ind_coil_ids +1;
ids_struct_out{ind_coil_ids}.current.data_error_upper = fixed_error.*ones(size(ids_struct_out{ind_coil_ids}.current.data));
ids_struct_out_description{ind_coil_ids}.current_data_error_upper = fixed_error.*ones(size(ids_struct_out{ind_coil_ids}.current.data));
......@@ -112,6 +113,7 @@ switch error_bar
for ii=1:ncircuits2ids
ncoil2ids = numel(coil_names2ids{ii}); % number of coils for a given circuit
for jj = 1:ncoil2ids
fixed_error = pf_def.coil_current_error{ii}(jj);
ind_coil_ids = ind_coil_ids +1;
ids_struct_out{ind_coil_ids}.current.data_error_upper = fixed_error.*ones(size(ids_struct_out{ind_coil_ids}.current.data));
ids_struct_out{ind_coil_ids}.current.data_error_lower = ids_struct_out{ind_coil_ids}.current.data_error_upper;
......@@ -123,6 +125,7 @@ switch error_bar
for ii=1:ncircuits2ids
ncoil2ids = numel(coil_names2ids{ii}); % number of coils for a given circuit
for jj = 1:ncoil2ids
fixed_error = pf_def.coil_current_error{ii}(jj);
ind_coil_ids = ind_coil_ids +1;
ids_struct_out{ind_coil_ids}.current.data_error_upper = ids_struct_out{ind_coil_ids}.current.data ...
+ fixed_error.*ones(size(ids_struct_out{ind_coil_ids}.current.data));
......@@ -135,6 +138,3 @@ switch error_bar
otherwise
error(['tcv_ids_bpol_loop: error_bar option not known: ' error_bar])
end
......@@ -15,7 +15,7 @@ if exist('gdat_params') && isfield(gdat_params,'error_bar') && ~isempty(gdat_par
error_bar = gdat_params.error_bar;
end
% Get data
% Get data
tmp = gdat_tcv( shot, 'ip_trapeze');
time = tmp.dim{1};
data = tmp.data;
......@@ -34,7 +34,7 @@ ids_struct_out_description{1}.diamagnetic_flux = ['from ' tmpdml.data_fullpath];
ids_struct_out{1}.diamagnetic_flux.time = tmpdml.t;
fixed_error_ip = 2.4e3;
fixed_error_diamagnetic_flux = 0.1;
fixed_error_diamagnetic_flux = 0.01;
switch error_bar
case 'delta'
ids_struct_out{1}.ip.data_error_upper = fixed_error_ip.*ones(size(ids_struct_out{1}.ip.data));
......
function [ combined_structure] = tcv_ids_pf_active_definition()
% All circuits are connected in series and has only 1 power supply, so they
% share the same current.
% share the same current.
% {Coil name}, [connection side identifier]
error_fixed = 200.;
coil_names_and_current_sign = {...
{'A_001'}, [1]; ... % Circuit 1
{'B_001', 'B_002', 'C_001', 'C_002', 'D_001', 'D_002'}, [1, 1, 1, 1, 1, 1]; ... % Circuit 2
{'E_001'}, [1]; ... % Circuit 3
{'E_002'}, [1]; ... % Circuit 4
{'E_003'}, [1]; ... % Circuit 5
{'E_004'}, [1]; ... % Circuit 6
{'E_005'}, [1]; ... % Circuit 7
{'E_006'}, [1]; ... % Circuit 8
{'E_007'}, [1]; ... % Circuit 9
{'E_008'}, [1]; ... % Circuit 10
{'F_001'}, [1]; ... % Circuit 11
{'F_002'}, [1]; ... % Circuit 12
{'F_003'}, [1]; ... % Circuit 13
{'F_004'}, [1]; ... % Circuit 14
{'F_005'}, [1]; ... % Circuit 15
{'F_006'}, [1]; ... % Circuit 16
{'F_007'}, [1]; ... % Circuit 17
{'F_008'}, [1]; ... % Circuit 18
{'G_001', 'G_002', 'G_003', 'G_004', 'G_005', 'G_006'}, [1,1,1,-1,-1,-1]; ... % Circuit 19 Lower coils connected in opposite direcetion
{'T_001', 'T_002', 'T_003'}, [1,1,-1]; ...% Circuit 20 %T003 in opposite direction
{'A_001'}, [1], error_fixed*0.007; ... % Circuit 1
{'B_001', 'B_002', 'C_001', 'C_002', 'D_001', 'D_002'}, [1, 1, 1, 1, 1, 1], ...
error_fixed*[0.03448275862, 0.03448275862, 0.08333333333333, 0.08333333333333, 0.125, 0.125]; ... % Circuit 2
{'E_001'}, [1], error_fixed*0.02941176470588; ... % Circuit 3
{'E_002'}, [1], error_fixed*0.02941176470588; ... % Circuit 4
{'E_003'}, [1], error_fixed*0.02941176470588; ... % Circuit 5
{'E_004'}, [1], error_fixed*0.02941176470588; ... % Circuit 6
{'E_005'}, [1], error_fixed*0.02941176470588; ... % Circuit 7
{'E_006'}, [1], error_fixed*0.02941176470588; ... % Circuit 8
{'E_007'}, [1], error_fixed*0.02941176470588; ... % Circuit 9
{'E_008'}, [1], error_fixed*0.02941176470588; ... % Circuit 10
{'F_001'}, [1], error_fixed*0.02777777777778; ... % Circuit 11
{'F_002'}, [1], error_fixed*0.02777777777778; ... % Circuit 12
{'F_003'}, [1], error_fixed*0.02777777777778; ... % Circuit 13
{'F_004'}, [1], error_fixed*0.02777777777778; ... % Circuit 14
{'F_005'}, [1], error_fixed*0.02777777777778; ... % Circuit 15
{'F_006'}, [1], error_fixed*0.02777777777778; ... % Circuit 16
{'F_007'}, [1], error_fixed*0.02777777777778; ... % Circuit 17
{'F_008'}, [1], error_fixed*0.02777777777778; ... % Circuit 18
{'G_001', 'G_002', 'G_003', 'G_004', 'G_005', 'G_006'}, [1,1,1,-1,-1,-1], error_fixed*[1, 1, 1, 1, 1, 1]; ... % Circuit 19 Lower coils connected in opposite direcetion
{'T_001', 'T_002', 'T_003'}, [1,1,-1], error_fixed*[2.61538489704145, 1.619047511111125, 1]; ...% Circuit 20 %T003 in opposite direction
};
power_supply_names_and_current_sign = {...
{'OH1'}, [1];... % Circuit 1
......@@ -50,6 +52,7 @@ power_supply_names_and_current_sign = {...
coil_names = {coil_names_and_current_sign{:,1}}';
coil_current_sign = {coil_names_and_current_sign{:,2}};
coil_current_error = {coil_names_and_current_sign{:,3}};
power_supply_names = {power_supply_names_and_current_sign{:,1}}';
power_supply_current_sign = {power_supply_names_and_current_sign{:,2}};
......@@ -87,6 +90,7 @@ combined_structure.coil_names = coil_names;
combined_structure.power_supply_names = power_supply_names;
combined_structure.mds_paths = mds_paths;
combined_structure.coil_current_signs = coil_current_sign;
combined_structure.coil_current_error = coil_current_error;
combined_structure.power_supply_current_signs = power_supply_current_sign;
combined_structure.circuit_names = circuit_names;
combined_structure = get_circuiting(combined_structure); %Add circuiting information
......@@ -104,7 +108,7 @@ end
% Each circuit has only 1 power supply-> number of elements per circuit =
% number of nodes per circuit= number of coils per circuit + 1;
circuit_struct.nnodespercircuit = circuit_struct.ncoilpercircuit + 1;
circuit_struct.nnodespercircuit = circuit_struct.ncoilpercircuit + 1;
circuit_struct.nelementspercircuit = circuit_struct.nnodespercircuit;
circuit_struct.ntotelements = sum(circuit_struct.nnodespercircuit);
......@@ -114,7 +118,7 @@ power_supply_index = 0;
coil_column_index = 2*circuit_struct.ntotpowersupplies ;
for ii=1:circuit_struct.ntotcircuits
circuit_connection_matrix = zeros(circuit_struct.nnodespercircuit(ii), 2*circuit_struct.ntotelements);
% Put power supply connection
power_supply_index = ii;
if circuit_struct.power_supply_current_signs{power_supply_index} == 1
......@@ -124,28 +128,28 @@ for ii=1:circuit_struct.ntotcircuits
circuit_connection_matrix(1,2*(power_supply_index-1)+1) = 1;
circuit_connection_matrix(circuit_struct.nnodespercircuit(ii),2*(power_supply_index-1)+2) = 1;
end
% Put coil connection
for jj=1:circuit_struct.ncoilpercircuit(ii)
if circuit_struct.coil_current_signs{ii}(jj) == 1
circuit_connection_matrix(jj, coil_column_index + 2*(jj-1) + 1 ) = 1;
circuit_connection_matrix(jj + 1, coil_column_index + 2*(jj-1) + 2 ) = 1;
elseif circuit_struct.coil_current_signs{ii}(jj) == -1
circuit_connection_matrix(jj, coil_column_index + 2*(jj-1) + 2 ) = 1;
circuit_connection_matrix(jj + 1, coil_column_index + 2*(jj-1) + 1 ) = 1;
end
end
coil_column_index = coil_column_index + 2*circuit_struct.ncoilpercircuit(ii);
circuit_struct.connection_matrix{ii} = circuit_connection_matrix;
% Plot all the connaction matrices as a check
doplot = 0;
if doplot
plot_connection_matrix(circuit_connection_matrix, circuit_struct.power_supply_names, circuit_struct.coil_names);
end
end
%% Plot connection matrix
......@@ -172,7 +176,7 @@ for ii=1:numel(psnames)
end
for ii=1:numel(cnames)
for jj=1:numel(cnames{ii})
index = index +1;
xlab{index} = [cnames{ii}{jj} 'in'];
index = index +1;
......@@ -187,4 +191,3 @@ colormap(bone(2))
xlabel('Element name');
ylabel('Node');
set(ax,'Xtick', xti, 'Ytick', yti, 'XTickLabel', xlab, 'YTickLabel', ylab')
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