0001 function external = load_externaldata_TS(workdir,shotnum,shotime,t1,t2,opt_gui)
0002
0003
0004
0005 if nargin <= 1,
0006 shotnum = input_dke_yp(['shotnumber'],'');
0007 end
0008
0009 if nargin <= 2,
0010 shotime = input_dke_yp(['shotime'],'');
0011 end
0012
0013 if nargin <= 3,
0014 t1 = input_dke_yp(['t1 (s)'],[]);
0015 end
0016
0017 if nargin <= 4,
0018 t2 = input_dke_yp(['t2 (s)'],[]);
0019 end
0020
0021 external = '';
0022 basestr = 'TS';
0023
0024 if exist('tsbase','file') ~= 3,
0025 disp('-----> Access to the TS database is not granted.')
0026 disp('-----> You need the mex file tsbase in the matlab path.');
0027 return;
0028 end
0029
0030
0031
0032 xpoint(1) = 1;
0033 xpoint(2) = 0;
0034 xpoint(3) = 0;
0035 xpoint(4) = 0;
0036 xpoint(5) = 1;
0037 xpoint(6) = 0;
0038 xpoint(7) = 0;
0039 xpoint(8) = 0;
0040
0041 while 1,
0042 certif_tprof = input_dke_yp('Enter a certification for ''tprof'' data: (-1) exit, 0 (no certification), 1, 2, 3, 4',0,{-1,0,1,2,3,4},'Invalid selection');
0043 if certif_tprof == -1,
0044 return
0045 end
0046
0047 [flag,ap,Rp,Zp,Bt,Ip,qmin,eq,qopt,Zi,mi,fi,Te0,Tea,eTe1,eTe2,ne0,nea,ene1,ene2,Ti0,Tia,eTi1,eTi2,Zeff0,Zeffa,eZeff,xZeff,vloop] = load_tprof_tsbase_yp(shotnum,certif_tprof,str2num(shotime),t1,t2,basestr);
0048 if isempty(ap),
0049 disp(['WARNING: ''tprof'' data do not exist for shot #',shotnum,' and certification ',int2str(certif_tprof),'. Please try another certification or exit.']);
0050 disp('WARNING: Missing tprof data must be created.');
0051 else
0052 break
0053 end
0054 end
0055
0056 while 1,
0057 certif_thyb = input_dke_yp('Enter a certification for ''thyb'' data: (-1) exit, 0 (no certification), 1, 2, 3, 4',0,{-1,0,1,2,3,4},'Invalid selection');
0058 if certif_thyb == -1,
0059 clear('LH');
0060 break
0061 end
0062
0063 [flag_LH,LH] = load_LH_tsbase_yp(shotnum,certif_thyb,str2num(shotime),t1,t2,basestr);
0064 if isempty(LH) || ~flag_LH,
0065 disp(['WARNING: No ''thyb'' data do not exist for shot #',shotnum,' and certification ',int2str(certif_thyb),'. Please try another certification or exit.']);
0066 else
0067 break
0068 end
0069 end
0070
0071 while 1,
0072 certif_tfce = input_dke_yp('Enter a certification for ''tfce'' data: (-1) exit, 0 (no certification), 1, 2, 3, 4',0,{-1,0,1,2,3,4},'Invalid selection');
0073 if certif_tfce == -1,
0074 clear('EC');
0075 break
0076 end
0077
0078 [flag_EC,EC] = load_EC_tsbase_yp(shotnum,certif_tfce,str2num(shotime),t1,t2,basestr);
0079 if isempty(EC) || ~flag_EC,,
0080 disp(['WARNING: No ''tfce'' data do not exist for shot #',shotnum,' and certification ',int2str(certif_tfce),'. Please try another certification or exit.']);
0081 else
0082 break
0083 end
0084 end
0085
0086
0087
0088 external.equil.shotnum = shotnum;
0089 external.equil.shotime = shotime;
0090
0091 external.equil.magnetic.ap = ap;
0092 external.equil.magnetic.Rp = Rp;
0093 external.equil.magnetic.Zp = Zp;
0094 external.equil.magnetic.Ip = Ip;
0095 external.equil.magnetic.Bt = Bt;
0096 external.equil.magnetic.qopt = qopt;
0097 external.equil.magnetic.qmin_Rpap = qmin*Rp/ap;
0098 external.equil.magnetic.eq = eq;
0099
0100 external.equil.magnetic.xpoint = xpoint;
0101
0102 external.equil.prof.Zi = Zi;
0103 external.equil.prof.mi = mi;
0104 external.equil.prof.fi = fi;
0105 external.equil.prof.Te0 = Te0;
0106 external.equil.prof.Tea = Tea;
0107 external.equil.prof.eTe1 = eTe1;
0108 external.equil.prof.eTe2 = eTe2;
0109 external.equil.prof.ne0 = ne0;
0110 external.equil.prof.nea = nea;
0111 external.equil.prof.ene1 = ene1;
0112 external.equil.prof.ene2 = ene2;
0113 external.equil.prof.Ti0 = Ti0;
0114 external.equil.prof.Tia = Tia;
0115 external.equil.prof.eTi1 = eTi1;
0116 external.equil.prof.eTi2 = eTi2;
0117 external.equil.prof.Zeff0 = Zeff0;
0118 external.equil.prof.Zeffa = Zeffa;
0119 external.equil.prof.eZeff = eZeff;
0120 external.equil.prof.xZeff = xZeff;
0121
0122 external.ohm.vloop = vloop;
0123
0124 if flag_LH,
0125 external.wave.LH = LH;
0126 end
0127
0128 if flag_EC,
0129 external.wave.EC = EC;
0130 end
0131
0132 external.id = ['TS_',shotnum,'_',shotime,'_',num2str(certif_tprof),'_',num2str(certif_thyb),'_',num2str(certif_tfce)];
0133