0001 function [antenna] = make_aloha_EAST_yp(aloha,antenna_measured)
0002
0003 optim.tolfun = 1e-2;
0004 optim.tolx = 1e-2;
0005 optim.nitmax = 30;
0006
0007 if size(aloha.power_in_modules,2) == 4,
0008 sc = EAST_ALOHA_scenario_2dot45GHz;
0009 elseif size(aloha.power_in_modules,2) == 6,
0010 sc = EAST_ALOHA_scenario_4dot60GHz;
0011 else
0012 error('Wrong definition of EAST LH antenna')
0013 end
0014
0015
0016
0017
0018
0019 sc.antenna.a_ampl = sqrt(aloha.power_in_modules*1000);
0020 sc.antenna.a_phase = pi*aloha.module_phasing/180;
0021
0022 if isfield(antenna_measured,'edge_ne') & isfield(antenna_measured,'rc')
0023 calcspectrum_opt = input_dke_yp('Calculation of the ALOHA power spectrum from edge density [0] or reflection coefficient [1] in external structure or from manual data input [2] ? ',0,0:2,'',[1,1]);
0024 elseif isfield(antenna_measured,'edge_ne') & ~isfield(antenna_measured,'rc')
0025 calcspectrum_opt = input_dke_yp('Calculation of the ALOHA power spectrum from edge density [0] in external structure or from manual data input [1] ? ',0,0:1,'',[1,1]);
0026 if calcspectrum_opt == 1,
0027 calcspectrum_opt = 2;
0028 end
0029 elseif ~isfield(antenna_measured,'edge_ne') & isfield(antenna_measured,'rc')
0030 calcspectrum_opt = input_dke_yp('Calculation of the ALOHA power spectrum from reflection coefficient [0] in external structure or from manual data input [1] ? ',0,0:1,'',[1,1]);
0031 if calcspectrum_opt == 1,
0032 calcspectrum_opt = 2;
0033 end
0034 elseif ~isfield(antenna_measured,'edge_ne') & ~isfield(antenna_measured,'rc')
0035 calcspectrum_opt = 2;
0036 end
0037
0038 if calcspectrum_opt == 0,
0039 edge_ne = antenna_measured.edge_ne;
0040 rc = '';
0041 elseif calcspectrum_opt == 1,
0042 edge_ne = '';
0043
0044 if size(aloha.power_in_modules,1) > 1,
0045 if size(aloha.power_in_modules) == size(antenna_measured.rc)
0046 rc = antenna_measured.rc;
0047 else
0048 if size(antenna_measured.rc,1) == 1 || size(antenna_measured.rc,2) == 1
0049 rc = ones(size(aloha.power_in_modules,1),1)*antenna_measured.rc(:)';
0050 if size(aloha.power_in_modules) ~= size(rc)
0051 error('Measured RC coefficients data for EAST LH antenna are inconsistent');
0052 end
0053 else
0054 error('Measured RC coefficients data for EAST LH antenna are inconsistent');
0055 end
0056 end
0057 else
0058 rc = antenna_measured.rc;
0059 end
0060
0061 optim.tolfun = input_dke_yp('Termination tolerance on the function value ? ',optim.tolfun,'','',[1,1]);
0062 optim.tolx = input_dke_yp('Termination tolerance on x ? ',optim.tolx,'','',[1,1]);
0063 optim.nitmax = input_dke_yp('Maximum number of iterations allowed ? ',optim.nitmax,'','',[1,1]);
0064 init_ne = input_dke_yp('Initial density (low density side (1e17 m-3) or high density side (5e18 m-3) ? ',1e17,'','',[1,1]);
0065
0066 sc.plasma.ne0 = init_ne;
0067
0068 elseif calcspectrum_opt == 2,
0069 edge_ne = input_dke_yp('Edge density in front of the antenna ? ',1e18,'','',[1,1]);
0070 rc = '';
0071 end
0072
0073 opt_gui = false;
0074 select.style = struct;
0075
0076 dkepath = load_structures_yp('dkepath','','');
0077
0078 scheduler.remnum = iselect_jd(dkepath.remprofiles,'Remote calculation mode (mdce_remote): ',opt_gui,select.style,1)-1;
0079 if scheduler.remnum == 0,
0080 flag_mdce = 1:length(dkepath.distprofiles);
0081 else
0082 flag_mdce = 1:3;
0083 end
0084
0085 scheduler.mode = iselect_jd(dkepath.distprofiles(flag_mdce),'Distributed computing mode : ',opt_gui,select.style,1) - 1;
0086
0087 if scheduler.mode > 2,
0088 scheduler.mode = 2 - scheduler.mode;
0089 end
0090
0091 antenna = build_aloha_power_spectrum_yp(sc,edge_ne,rc,optim,dkepath,scheduler);
0092
0093 if ~isfield(antenna,'job')
0094
0095 if size(aloha.power_in_modules,1) > 1
0096
0097 RC{1} = antenna.aloha.results.RC;
0098 dP_nz{1} = antenna.aloha.results.dP_nz;
0099
0100 for ii=2:size(aloha.power_in_modules,1)
0101
0102 antenna.aloha.antenna.a_ampl = sqrt(aloha.power_in_modules(ii,:)*1000)';
0103 antenna.aloha.antenna.a_phase = pi*aloha.module_phasing(ii,:)'/180;
0104
0105 antenna.aloha = aloha_compute_RC(antenna.aloha);
0106 antenna.aloha = aloha_compute_spectrum(antenna.aloha);
0107
0108 RC{ii} = antenna.aloha.results.RC;
0109 dP_nz{ii} = antenna.aloha.results.dP_nz;
0110
0111 end
0112 end
0113
0114 antenna.aloha.results.RC = RC;
0115 antenna.aloha.results.dP_nz = dP_nz;
0116
0117 end
0118
0119
0120
0121