1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
close all;clear all;
%% Init
[~,directory]=uigetfile('*.wfm','WaveForm Folder','Select a wfm file');
s=strfind(directory,'\');
dirf=directory(1:s(end-1));
dirlist=dir(dirf);
sql=0;
type='RH';
clear s;
for d=3:length(dirlist)
dirfile=[dirf dirlist(d).name '\'];
filelist = dir(fullfile(dirfile,'*.wfm')); %variable contenant les noms de tout les *.wfm
validIDW=0;
finalh=[];finalres0=[];
for f=1:length(filelist)
%% File opening
valid=0;clear dday;clear ttime;clear chipF;clear devF;clear device;clear Row;clear Col;clear tline;
clear field;clear Lot;clear wfr;clear dataB;clear wfrlist;clear lot;clear idwfm;
clear RH;clear rouge;
file = filelist(f).name;%on sélectionne le nom du iéme *.wfm
fid1 = fopen(strcat(dirfile,file)); %on ouvre le fichier
%% Wfm Register
tline = fgetl(fid1);tline = fgetl(fid1);%On parcous 2 lignes
[~,dday]=strtok(tline);
tline = fgetl(fid1);
[~,ttime]=strtok(tline);
dot=datenum([dday ' ' ttime]); %dot=DateOfTest
tline = fgetl(fid1);tline = fgetl(fid1);%Chip File
[~,chipF]=strtok(tline(find(isspace(tline)==1):end));
tline = fgetl(fid1);%Device File
[~,devF]=strtok(tline(find(isspace(tline)==1):end));
tline = fgetl(fid1);tline = fgetl(fid1);%Device name
[~,device]=strtok(tline);
if find(isspace(device)==1)
device=device(find(isspace(device)==0));
end
while valid==0
tline = fgetl(fid1);
[param,~]=strtok(tline);
switch param
case 'Col_abs'
[~,Col]=strtok(tline);[~,Col]=strtok(Col);[Col,~]=strtok(Col);Col=str2double(Col);
case 'FieldFile'
[~,field]=strtok(tline);[~,field]=strtok(field);
case 'Lot'
[~,Lot]=strtok(tline);[~,Lot]=strtok(Lot);[Lot,~]=strtok(Lot);
case 'Row_abs'
[~,Row]=strtok(tline);[~,Row]=strtok(Row);[Row,~]=strtok(Row);Row=str2num(Row);
case 'Wafer'
[~,wfr]=strtok(tline);[~,wfr]=strtok(wfr);[wfr,~]=strtok(wfr);
case 'Vsource'
[~,vsource]=strtok(tline);[~,vsource]=strtok(vsource);[vsource,~]=strtok(vsource);vsource=str2num(vsource);
case 'ShowPoints'
valid=1;
end
end
%% Connection SQL
if sql==0
conn=database('XX','xx','xx');
if isconnection(conn)
disp(['Connection ' XX' SQL established']);
else
error(['Connection ' XX' SQL failed'])
end
orig={};origr={};origh={};
dblist=tables(conn);
orig=cellstr(dblist(find(strcmp(dblist,'Waveform_register')==1))); %Table SQL Registre
origr=cellstr(dblist(find(strcmp(dblist,'Waveform_res0')==1))); % Table SQL Resistance
origh=cellstr(dblist(find(strcmp(dblist,'Waveform_hdrive')==1))); % Table SQL Field
if isempty(orig)
error('Waveform_register is missing')
end
origcol=fetch(conn,['show columns from ' orig{:}]);
if length(origcol)~=12
origcol=fetch(conn,['show columns from ' orig{:}]);
end
origcol=origcol(:,1);
sql=1;
end
%% Index Sync = Selection d'un index dans une table SQL
if validIDW==0
idw=fetch(conn,['select * from Register where Register.Wafer_ID like(''W' lot '%'')']);
validIDW=1;
end
%% Table_SQL: Wafeform Register
final=[];
final{end+1,1}=Lot;
final{end,2}=wfr;
final{end,3}=idw{find(strcmp(idw,wfr)==1),2};
final{end,5}=dot;
final{end,6}=Row;
final{end,7}=Col;
final{end,8}=device;
final{end,9}=type;
final{end,10}=chipF;
final{end,11}=devF;
final{end,12}=field;
final{end,13}=vsource;
fastinsert(conn,orig{:},origcol,final); %insert final dans SQL_table: Wafeform Register
%% Table_SQL res 0 & hdrive
idwfm=fetch(conn,['select idwfm from Waveform_register where idw=' num2str(final{end,3}) ' and Datetime=''' datestr(dot,'yyyy-mm-dd HH:MM:SS') ''''...
' and Row=' num2str(Row) ' and Col=' num2str(Col) ' and Device=''' device ''' and Kind_of_test=''' type '''']); % selection d'un index correspondant au fichier en cours de traitement.
disp(['Waveform_register is updated for idwfm=' num2str(idwfm{:})]);
valid=0;clear final;
while valid==0
tline = fgetl(fid1); %On descent jusqu'à la 83éme ligne du fichier wfm
if strfind(tline,'LongReport')>=0
tline = fgetl(fid1);
tline = fgetl(fid1);
tline = fgetl(fid1);
tline = fgetl(fid1);
for i=1:1000
tline = fgetl(fid1);
RH{i}=strread(tline,'%s','delimiter','\t'); %On transfère tous les points dans un Tableau de cell
end
valid=1;
end
end
fc=-1;
while fc==-1
fc=fclose(fid1);
end
finalres0{end+1,1}=idw{find(strcmp(idw,wfr)==1),2};
finalres0{end,2}=idwfm{:};
finalres0{end,3}=wfr;
finalres0{end,4}=dot;
finalres0{end,5}=Row;
finalres0{end,6}=Col;
finalres0{end,7}=device;
finalh{end+1,1}=idw{find(strcmp(idw,wfr)==1),2};
finalh{end,2}=idwfm{:};
finalh{end,3}=wfr;
finalh{end,4}=dot;
finalh{end,5}=Row;
finalh{end,6}=Col;
finalh{end,7}=device;
for i=1:1000 %Mise en forme des données présente dans la variable RH
rouge = RH{i};
finalres0{end,(i+7)} = str2double(rouge{6}); %on enregistre les valeurs de res0
finalh{end,(i+7)}=str2double(rouge{5}); %on enregistre les valeurs de hdrive
end
clear RH;clear rouge;
if size(finalh,1)==1000 || f==length(filelist)
%% Column name
origcolr=fetch(conn,['show columns from ' origr{:}]);
origcolr=origcolr(:,1); %Nom des colonnes de la table Waveform_res0
origcolh=fetch(conn,['show columns from ' origh{:}]);
origcolh=origcolh(:,1); %Nom des colonnes de la table Waveform_hdrive
%%
fastinsert(conn,origr{:},origcolr,finalres0); %insert final dans SQL_table: Waveform_res0
disp(['Waveform_res0 is updated for idwfm=' num2str(idwfm{:})]);
clear finalres0;pause(0.5);
fastinsert(conn,origh{:},origcolh,finalh); %insert final dans SQL_table: Waveform_hdrive
clear finalh;pause(0.5);
disp(['Waveform_hdrive is updated for idwfm=' num2str(idwfm{:})]);
clear finalh;clear finalres0;clear origcolh;clear origcolr;
finalh=[];finalres0=[];
end
end
clear filelist;
end
close(conn); |
Partager