% Funzione che ricostruisce la tipologia di nodi presenti % NodoTiltLink ad esempio contiene numero del nodo e profondità per tutti i % nodi di questo tipo % idTool rappresenta l'identificativo con cui sono definite le % installazioni su DB, serve più avanti nell'elaborazione % idNode scrive gli identificativi dei nodi del DB. E' un output di % controllo function [idTool,NodoTunnelLink,NodoRadialLink,NodoTiltLinkH,... NodoTiltLinkHRH,NodoPreConvLink,NodoPreConvLinkHR,NodoDistoMTLink,NodoPressureLink,... NodoLoadLink,NodoExtensometerLink,Nodo3DExtensometerLink,NodoWireExtensometerLink,... NodoMultiPointRodExtensometer,NodoTiltLinkHR3DH,NodoPreConvLinkHR3D,... NodoAnalogLink,NodoCrackLink,Nodo3DCrackLink,Nodo2DCrackLink,NodoStressMeter,... rTuL,rRL,rTLH,rTLHRH,rPCL,rPCLHR,rPrL,rLL,rEL,r3DEL,rWEL,rMPBEL,rAL,rCrL,r3DCrL,... r2DCrL,rSM,rTLHR3DH,rPCLHR3D,rDM] = tipologiaNodi(DTcatena,unitID,conn,FileName) fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'tipologiaNodi function started'; fprintf(fileID,fmt,text); %% A partire dal nome della catena, risalgo all'identificativo con cui è % definita nel Database (mi serve successivamente) comando = ['select id from tools where name = ''' DTcatena ''' and unit_id = ''' unitID ''' ']; idTool = num2str(cell2mat(fetch(conn,comando))); % leggo e converto in stringa %% Tunnel Link % carico le informazioni relative al numero e alla posizione (rispetto all'ancora % considerando la circonferenza come una retta verticale) per Tunnel LINK comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 17 order by num']; Leggo = fetch(conn,comando); [rTuL,cL] = size(Leggo); if rTuL <= 1 && cL <= 1 textTuL = 'There are not Tunnel Link;'; NodoTunnelLink = []; rTuL = 0; else % depth è la posizione del nodo (considerando una verticale progressiva) depth = cell2mat(Leggo(:,2)); depth = num2cell(depth); nome = cell(rTuL,1); for i=1:rTuL nome(i,1) = cellstr('Tunnel Link'); end NodoTunnelLink = [nome Leggo(:,1) depth Leggo(:,3)]; textTuL = ['There are ',num2str(rTuL),' Tunnel Link;']; end fprintf(fileID,fmt,textTuL); %% Radial Link % carico le informazioni relative al numero e alla posizione (rispetto all'ancora % considerando la circonferenza come una retta verticale) per Radial LINK comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 18 order by num']; Leggo = fetch(conn,comando); [rRL,cL] = size(Leggo); if rRL <= 1 && cL <= 1 textRL = 'There are not Radial Link;'; NodoRadialLink = []; rRL = 0; else % depth è la posizione del nodo (considerando una verticale progressiva) depth = cell2mat(Leggo(:,2)); depth = num2cell(depth); nome = cell(rRL,1); for i=1:rRL nome(i,1) = cellstr('Radial Link'); end NodoRadialLink = [nome Leggo(:,1) depth Leggo(:,3)]; textRL = ['There are ',num2str(rRL),' Radial Link;']; end fprintf(fileID,fmt,textRL); %% Tilt Link H % carico le informazioni relative al numero e alla lunghezza per TILT LINK % H (nodo orizzontale) comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 11 order by num']; Leggo = fetch(conn,comando); [rTLH,cL] = size(Leggo); if rTLH <= 1 && cL <= 1 textTLH = 'There are not Tilt Link H;'; NodoTiltLinkH = []; nodoTLH = 0; % mi serve nei Tilt Link H HR3D rTLH = 0; else nodoTLH = 1; % mi serve nei Tilt Link H HR3D % depth in questo caso è la lunghezza in orizzontale depth = Leggo(:,2); nome = cell(rTLH,1); for i=1:rTLH nome(i,1) = cellstr('Tilt Link H'); end NodoTiltLinkH = [nome Leggo(:,1) depth Leggo(:,3)]; textTLH = ['There are ',num2str(rTLH),' Tilt Link H;']; end fprintf(fileID,fmt,textTLH); %% Tilt Link HR H % carico le informazioni relative al numero e alla lunghezza per TILT LINK % HR H (ampolla orizzontale) comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 12 order by num']; Leggo = fetch(conn,comando); [rTLHRH,cL] = size(Leggo); if rTLHRH <= 1 && cL <= 1 textTLHRH = 'There are not Tilt Link HR H;'; NodoTiltLinkHRH = []; nodoTLHRH = 0; % mi serve a riconoscere i Tilt Link HR3D H rTLHRH = 0; else nodoTLHRH = 1; % mi serve a riconoscere i Tilt Link HR3D H % la profondità in realtà indica la lunghezza in orizzontale depth = Leggo(:,2); nome = cell(rTLHRH,1); for i=1:rTLHRH nome(i,1) = cellstr('Tilt Link HR H'); end NodoTiltLinkHRH = [nome Leggo(:,1) depth]; textTLHRH = ['There are ',num2str(rTLHRH),' Tilt Link HR H;']; end fprintf(fileID,fmt,textTLHRH); % confrontando le profondità (in realtà lunghezze in orizzontale) di Tilt % Link H e Tilt Link HR H riconosco i TILT LINK HR 3D H if nodoTLH == 1 && nodoTLHRH == 1 NodoTiltLinkHR3Dwork = cell(rTLH,4); % creo matrice di zeri p=1; Control = 0; for i=1:rTLH for j=1:rTLHRH if cell2mat(NodoTiltLinkH(i,3)) == cell2mat(NodoTiltLinkHRH(j,3)) prof = NodoTiltLinkH(i,3); nome = cellstr('Tilt Link HR 3D H'); % il numero nodo del Tilt Link H lo faccio diventare il % numero nodo del Tilt Link HR3D H num = NodoTiltLinkH(i,2); num2 = NodoTiltLinkHRH(i,2); Leggo = [nome,num,num2,prof]; NodoTiltLinkHR3Dwork(p,:) = Leggo; p = p+1; Control = 1; end end end % elimino gli zeri in più q = 1; r = 0; while strcmp(NodoTiltLinkHR3Dwork(q,1),'Tilt Link HR 3D H') q = q+1; r = 1+r; % ultima riga con dati che non siano celle vuote if q > rTLH || q > rTLHRH break % esco dal ciclo while end end if Control == 1 NodoTiltLinkHR3DH = NodoTiltLinkHR3Dwork(1:r,:); elseif Control == 0 NodoTiltLinkHR3DH = []; end textTLHR3DH = ['There are ',num2str(r),' Tilt Link HR 3D H;']; else textTLHR3DH = 'There are not Tilt Link HR 3D H;'; NodoTiltLinkHR3DH = []; r = 0; end fprintf(fileID,fmt,textTLHR3DH); rTLHR3DH = r; %% PreConv Link % carico le informazioni relative al numero e alla lunghezza per PreConv % Link (nodo per la misura di PRE-Convergenza) comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 23 order by num']; Leggo = fetch(conn,comando); [rPCL,cL] = size(Leggo); if rPCL <= 1 && cL <= 1 textPCL = 'There are not PreConv Link; '; NodoPreConvLink = []; nodoPCL = 0; % mi serve nei Pre Conv Link HR 3D rPCL = 0; else nodoPCL = 1; % mi serve nei Pre Conv Link HR 3D % depth in questo caso è la lunghezza in orizzontale depth = Leggo(:,2); nome = cell(rPCL,1); for i=1:rPCL nome(i,1) = cellstr('PreConv Link'); end NodoPreConvLink = [nome Leggo(:,1) depth Leggo(:,3)]; textPCL = ['There are ',num2str(rPCL),' PreConv Link;']; end fprintf(fileID,fmt,textPCL); %% PreConv Link HR % carico le informazioni relative al numero e alla lunghezza per TILT LINK % HR H (ampolla orizzontale) comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 24 order by num']; Leggo = fetch(conn,comando); [rPCLHR,cL] = size(Leggo); if rPCLHR <= 1 && cL <= 1 textPCLHR = 'There are not PreConv Link HR; '; NodoPreConvLinkHR = []; nodoPCLHR = 0; % mi serve a riconoscere i PreConv Link HR 3D rPCLHR = 0; else nodoPCLHR = 1; % mi serve a riconoscere i PreConv Link HR 3D % la profondità in realtà indica la lunghezza in orizzontale depth = Leggo(:,2); nome = cell(rPCLHR,1); for i=1:rPCLHR nome(i,1) = cellstr('Pre Conv Link HR'); end NodoPreConvLinkHR = [nome Leggo(:,1) depth]; textPCLHR = ['There are ',num2str(rPCLHR),' PreConv Link HR;']; end fprintf(fileID,fmt,textPCLHR); % confrontando le profondità (in realtà lunghezze in orizzontale) di PreConv Link % e PreConv Link HR riconosco i PreConv Link HR 3D if nodoPCL == 1 && nodoPCLHR == 1 NodoPreConvLinkHR3Dwork = cell(rPCL,4); % creo matrice di zeri p=1; Control = 0; for i=1:rPCL for j=1:rPCLHR if cell2mat(NodoPreConvLink(i,3)) == cell2mat(NodoPreConvLink(j,3)) prof = NodoPreConvLink(i,3); nome = cellstr('PreConv Link HR 3D'); % il numero nodo del PreConv Link lo faccio diventare il % numero nodo del PreConv Link HR 3D num = NodoPreConvLink(i,2); num2 = NodoPreConvLinkHR(i,2); Leggo = [nome,num,num2,prof]; NodoPreConvLinkHR3Dwork(p,:) = Leggo; p = p+1; Control = 1; end end end % elimino gli zeri in più q = 1; r = 0; while strcmp(NodoPreConvLinkHR3Dwork(q,1),'PreConv Link HR 3D') q = q+1; r = 1+r; % ultima riga con dati che non siano celle vuote if q > rPCL || q > rPCLHR break % esco dal ciclo while end end if Control == 1 NodoPreConvLinkHR3D = NodoPreConvLinkHR3Dwork(1:r,:); elseif Control == 0 NodoPreConvLinkHR3D = []; end textPCLHR3D = ['There are ',num2str(r),' PreConv Link HR 3D; ']; else textPCLHR3D = 'There are not PreConv Link HR 3D; '; NodoPreConvLinkHR3D = []; r = 0; end rPCLHR3D = r; fprintf(fileID,fmt,textPCLHR3D); %% DistoMT Link % carico le informazioni relative al numero e alla posizione (rispetto all'ancora % considerando la circonferenza come una retta verticale) per Tunnel LINK comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 56 order by num']; Leggo = fetch(conn,comando); [rDM,cL] = size(Leggo); if rDM <= 1 && cL <= 1 textDM = 'There are not DistoMT Link;'; NodoDistoMTLink = []; rDM = 0; else % depth è la posizione del nodo (considerando una verticale progressiva) depth = cell2mat(Leggo(:,2)); depth = num2cell(depth); nome = cell(rDM,1); for i=1:rDM nome(i,1) = cellstr('DistoMT Link'); end NodoDistoMTLink = [nome Leggo(:,1) depth Leggo(:,3)]; textDM = ['There are ',num2str(rDM),' DistoMT Link;']; end fprintf(fileID,fmt,textDM); %% Pressure Link % carico le informazioni relative al numero per Pressure LINK comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 21 order by num']; Leggo = fetch(conn,comando); [rPrL,cL] = size(Leggo); if rPrL <= 1 && cL <= 1 textPrL = 'There are not Pressure Link; '; NodoPressureLink = []; rPrL = 0; else % cambio il segno della profondità (nel DB è positivo) nome = cell(rPrL,1); for i=1:rPrL nome(i,1) = cellstr('Pressure Link'); end NodoPressureLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textPrL = ['There are ',num2str(rPrL),' Pressure Link; ']; end fprintf(fileID,fmt,textPrL); %% Load Link % carico le informazioni relative al numero per LOAD LINK comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 15 order by num']; Leggo = fetch(conn,comando); [rLL,cL] = size(Leggo); if rLL <= 1 && cL <= 1 textLL = 'There are not Load Link; '; NodoLoadLink = []; rLL = 0; else nome = cell(r,1); for i=1:rLL nome(i,1) = cellstr('Load Link'); end NodoLoadLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textLL = ['There are ',num2str(rLL),' Load Link; ']; end fprintf(fileID,fmt,textLL); %% Extensometer Link % carico le informazioni relative al numero per EXTENSOMETER LINK comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 16 order by num']; Leggo = fetch(conn,comando); [rEL,cL] = size(Leggo); if rEL <= 1 && cL <= 1 textEL = 'There are not Extensometer Link; '; NodoExtensometerLink = []; rEL = 0; else nome = cell(rEL,1); for i=1:rEL nome(i,1) = cellstr('Extensometer Link'); end NodoExtensometerLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textEL = ['There are ',num2str(rEL),' Extensometer Link; ']; end fprintf(fileID,fmt,textEL); %% 3D Extensometer Link % carico le informazioni relative al numero per 3D EXTENSOMETER LINK comando = ['select num, depth, channels, measurment, therm, orientation from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 19 order by num']; Leggo = fetch(conn,comando); [r3DEL,cL] = size(Leggo); if r3DEL <= 1 && cL <= 1 text3DEL = 'There are not 3D Extensometer Link; '; Nodo3DExtensometerLink = []; r3DEL = 0; else nome = cell(r3DEL,1); for i=1:r3DEL nome(i,1) = cellstr('3D Extensometer Link'); end Nodo3DExtensometerLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5) Leggo(:,6)]; text3DEL = ['There are ',num2str(r3DEL),' 3D Extensometer Link; ']; end fprintf(fileID,fmt,text3DEL); %% Wire Extensometer Link % carico le informazioni relative al numero per Wire EXTENSOMETER LINK comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 22 order by num']; Leggo = fetch(conn,comando); [rWEL,cL] = size(Leggo); if rWEL <= 1 && cL <= 1 textWEL = 'There are not Wire Extensometer Link; '; NodoWireExtensometerLink = []; rWEL = 0; else nome = cell(rWEL,1); for i=1:rWEL nome(i,1) = cellstr('Wire Extensometer Link'); end NodoWireExtensometerLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textWEL = ['There are ',num2str(rWEL),' Wire Extensometer Link; ']; end fprintf(fileID,fmt,textWEL); %% Multi Point Borehole Rod Extensometer % carico le informazioni relative al numero per Multi Point Borehole Rod Extensometer comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 25 order by num']; Leggo = fetch(conn,comando); [rMPBEL,cL] = size(Leggo); if rMPBEL <= 1 && cL <= 1 textMPBEL = 'There are not Multi Point Borehole Rod Extensometer Link; '; NodoMultiPointRodExtensometer = []; rMPBEL = 0; else nome = cell(rMPBEL,1); for i=1:rMPBEL nome(i,1) = cellstr('Multi Point Borehole Rod Extensometer Link'); end NodoMultiPointRodExtensometer = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textMPBEL = ['There are ',num2str(rMPBEL),' Multi Point Borehole Rod Extensometer Link; ']; end fprintf(fileID,fmt,textMPBEL); %% Crack Link comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 36 order by num']; Leggo = fetch(conn,comando); [rCrL,cL] = size(Leggo); if rCrL <= 1 && cL <= 1 textCrL = 'There are not Crack Link; '; NodoCrackLink = []; rCrL = 0; else nome = cell(rCrL,1); for i=1:rCrL nome(i,1) = cellstr('Crack Link'); end NodoCrackLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textCrL = ['There are ',num2str(rCrL),' Crack Link; ']; end fprintf(fileID,fmt,textCrL); %% 3D Crack Link comando = ['select num, depth, channels, measurment, therm, orientation from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 37 order by num']; Leggo = fetch(conn,comando); [r3DCrL,cL] = size(Leggo); if r3DCrL <= 1 && cL <= 1 text3DCrL = 'There are not 3D Crack Link; '; Nodo3DCrackLink = []; r3DCrL = 0; else nome = cell(r3DCrL,1); for i=1:r3DCrL nome(i,1) = cellstr('3D Crack Link'); end Nodo3DCrackLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5) Leggo(:,6)]; text3DCrL = ['There are ',num2str(r3DCrL),' 3D Crack Link; ']; end fprintf(fileID,fmt,text3DCrL); %% 2D Crack Link comando = ['select num, depth, channels, measurment, therm, orientation from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 51 order by num']; Leggo = fetch(conn,comando); [r2DCrL,cL] = size(Leggo); if r2DCrL <= 1 && cL <= 1 text2DCrL = 'There are not 2D Crack Link; '; Nodo2DCrackLink = []; r2DCrL = 0; else nome = cell(r2DCrL,1); for i=1:r2DCrL nome(i,1) = cellstr('2D Crack Link'); end Nodo2DCrackLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5) Leggo(:,6)]; text2DCrL = ['There are ',num2str(r3DCrL),' 2D Crack Link; ']; end fprintf(fileID,fmt,text2DCrL); %% Analog Link % carico le informazioni relative al numero per Analog Link comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 8 order by num']; Leggo = fetch(conn,comando); [rAL,cL] = size(Leggo); if rAL <= 1 && cL <= 1 textAL = 'There are not Analog Link; '; NodoAnalogLink = []; rAL = 0; else nome = cell(rAL,1); for i=1:rAL nome(i,1) = cellstr('Analog Link'); end NodoAnalogLink = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textAL = ['There are ',num2str(rAL),' Analog Link;']; end fprintf(fileID,fmt,textAL); %% Stress Meter comando = ['select num, depth, channels, measurment, therm from nodes where tool_id = ''' ... idTool ''' and nodetype_id = 47 order by num']; Leggo = fetch(conn,comando); [rSM,cL] = size(Leggo); if rSM <= 1 && cL <= 1 textSM = 'There are not Stress Meter; '; NodoStressMeter = []; rSM = 0; else nome = cell(rSM,1); for i=1:rSM nome(i,1) = cellstr('Stress Meter'); end NodoStressMeter = [nome Leggo(:,1) Leggo(:,4) Leggo(:,3) Leggo(:,5)]; textSM = ['There are ',num2str(r3DCrL),' Stress Meter; ']; end fprintf(fileID,fmt,textSM); text = 'tipologiaNodi function ended'; fprintf(fileID,fmt,text); fclose(fileID); end