Files
matlab-python/Tilt/tipologiaNodi.m

696 lines
24 KiB
Matlab
Executable File

% 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,NodoTiltLink,NodoTiltLinkHR,NodoTiltLinkH,NodoTiltLinkHRH,...
NodoTiltLinkHR3D,NodoTiltLinkHR3DH,NodoPiezoLink,NodoBaroLink,...
NodoThermLink,NodoAnalogLink,NodoLoadLink,NodoKlinoLink,NodoKlinoLinkHR,...
NodoRainLink,NodoPT100Link,NodoInPlaceLink,NodoInPlaceLinkHR,NodoInPlaceLinkHR3D,...
NodoWeirLink,NodoPendulum,NodoWind,NodoTiltLinkHD,NodoTiltLinkHDVR,NodoSPPLink,NodoSnowLink,...
rTL,rTLHR,rTLH,rTLHRH,rTLHR3D,rTLHR3DH,rPL,rBL,rThL,rAL,rLL,rKL,rKLHR,...
rRL,rPT100,rIPL,rIPLHR,rIPLHR3D,rWL,rPE,rWI,rHD,rHDVR,rSPP,rSL]...
= 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
%% Tilt Link V
% carico le informazioni relative al numero e alla profondità per TILT LINK
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 1 order by num'];
Leggo = fetch(conn,comando);
[rTL,cL] = size(Leggo);
if rTL <= 1 && cL <= 1
textTL = 'There are not Tilt Link V; ';
NodoTiltLink = [];
nodoTL = 0; % mi serve nei Tilt Link HR3D
rTL = 0;
else
nodoTL = 1; % mi serve nei Tilt Link HR3D
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rTL,1);
for i=1:rTL
nome(i,1) = cellstr('Tilt Link V');
end
NodoTiltLink = [nome Leggo(:,1) depth Leggo(:,3)];
textTL = ['There are ',num2str(rTL),' Tilt Link V nodes; '];
end
fprintf(fileID,fmt,textTL);
%% Piezo Link
% carico le informazioni relative al numero e alla profondità per PIEZO LINK
comando = ['select num, depth, measurment, therm from nodes where tool_id = ''' idTool ''' and nodetype_id = 2 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rPL,cL] = size(Leggo);
if rPL == 1 && cL == 1
textPL = 'There are not Piezo Link; ';
rPL = 0;
NodoPiezoLink = [];
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rPL,1);
for i=1:rPL
nome(i,1) = cellstr('Piezo Link');
end
NodoPiezoLink = [nome Leggo(:,1) depth Leggo(:,3) Leggo(:,4)];
textPL = ['There are ',num2str(rPL),' Piezo Link nodes; '];
end
fprintf(fileID,fmt,textPL);
%% Baro Link
% carico le informazioni relative al numero e alla profondità per BARO LINK
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 3 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rBL,cL] = size(Leggo);
if rBL == 1 && cL == 1
textBL = 'There are not Baro Link; ';
NodoBaroLink = [];
rBL = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rBL,1);
for i=1:rBL
nome(i,1) = cellstr('Baro Link');
end
NodoBaroLink = [nome Leggo(:,1) depth Leggo(:,3)];
textBL = ['There are ',num2str(rBL),' Baro Link nodes; '];
end
fprintf(fileID,fmt,textBL);
%% Therm Link
% carico le informazioni relative al numero e alla profondità per THERM LINK
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 4 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rThL,cL] = size(Leggo);
if rThL == 1 && cL == 1
textThL = 'There are not Therm Link; ';
NodoThermLink = [];
rThL = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rThL,1);
for i=1:rThL
nome(i,1) = cellstr('Therm Link');
end
NodoThermLink = [nome Leggo(:,1) depth Leggo(:,3)];
textThL = ['There are ',num2str(rThL),' Therm Link nodes; '];
end
fprintf(fileID,fmt,textThL);
%% Tilt Link HR V
% carico le informazioni relative al numero e alla profondità per TILT LINK HR V
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 5 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rTLHR,cL] = size(Leggo);
if rTLHR == 1 && cL == 1
textTLHR = 'There are not Tilt Link HR V; ';
NodoTiltLinkHR = [];
nodoTLHR = 0; % mi serve a riconoscere i Tilt Link HR3D
rTLHR = 0;
else
nodoTLHR = 1; % mi serve a riconoscere i Tilt Link HR3D
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rTLHR,1);
for i=1:rTLHR
nome(i,1) = cellstr('Tilt Link HR V');
end
NodoTiltLinkHR = [nome Leggo(:,1) depth];
textTLHR = ['There are ',num2str(rTLHR),' Tilt Link HR V nodes; '];
end
fprintf(fileID,fmt,textTLHR);
% confrontando le profondità di Tilt Link e Tilt Link HR riconosco i TILT LINK HR 3D
if nodoTL == 1 && nodoTLHR == 1
NodoTiltLinkHR3Dwork = cell(rTL,4); % creo matrice di zeri
p=1;
Control = 0;
for i=1:rTL
for j=1:rTLHR
if cell2mat(NodoTiltLink(i,3)) == cell2mat(NodoTiltLinkHR(j,3))
prof = NodoTiltLink(i,3);
nome = cellstr('Tilt Link HR 3D V');
% il numero nodo del Tilt Link lo faccio diventare il numero nodo del Tilt Link HR3D
num = NodoTiltLink(i,2);
num2 = NodoTiltLinkHR(j,2);
Leggo = [nome,num,num2,prof];
NodoTiltLinkHR3Dwork(p,:) = Leggo;
p = p+1;
Control = 1;
break
end
end
end
% elimino gli zeri in più
q = 1;
rCONT = 0;
[s,~] = size(NodoTiltLinkHR3Dwork);
a = 1;
while a == 1
if q > s
a = 0;
else
if strcmp(cell2mat(NodoTiltLinkHR3Dwork(q,1)),'Tilt Link HR 3D V')
rCONT = 1+rCONT; % ultima riga con dati che non siano celle vuote
end
end
q = q+1;
end
if Control == 1
NodoTiltLinkHR3D = NodoTiltLinkHR3Dwork(1:rCONT,:);
elseif Control == 0
NodoTiltLinkHR3D = [];
end
textTLHR3D = ['There are ',num2str(rCONT),' Tilt Link HR 3D V nodes; '];
else
textTLHR3D = 'There are not Tilt Link HR 3D V; ';
NodoTiltLinkHR3D = [];
rCONT = 0;
end
rTLHR3D = rCONT;
fprintf(fileID,fmt,textTLHR3D);
%% Tilt Link H
% carico le informazioni relative al numero e alla profondità per TILT LINK H
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 11 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[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 nodes; '];
end
fprintf(fileID,fmt,textTLH);
%% Tilt Link HR H
% carico le informazioni relative al numero e alla profondità per TILT LINK HR H
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 12 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[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 nodes; '];
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;
rCONT = 0;
while strcmp(NodoTiltLinkHR3Dwork(q,1),'Tilt Link HR 3D H')
q = q+1;
rCONT = 1+rCONT; % 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:rCONT,:);
elseif Control == 0
NodoTiltLinkHR3DH = [];
end
textTLHR3DH = ['There are ',num2str(rCONT),' Tilt Link HR 3D H nodes; '];
else
textTLHR3DH = 'There are Tilt Link HR 3D H nodes; ';
NodoTiltLinkHR3DH = [];
end
fprintf(fileID,fmt,textTLHR3DH);
rTLHR3DH = rCONT;
%% Analog Link
% carico le informazioni relative al numero e alla profondità per ANALOG LINK
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 8 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rAL,cL] = size(Leggo);
if rAL == 1 && cL == 1
textAL = 'There are not Analog Link; ';
NodoAnalogLink = [];
rAL = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rAL,1);
for i=1:rAL
nome(i,1) = cellstr('Analog Link');
end
NodoAnalogLink = [nome Leggo(:,1) depth];
% inverto la matrice Nodi (il primo nodo è il più profondo)
textAL = ['There are ',num2str(rAL),' Analog Link nodes; '];
end
fprintf(fileID,fmt,textAL);
%% Load Link
% carico le informazioni relative al numero e alla profondità per LOAD LINK
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 15 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rLL,cL] = size(Leggo);
if rLL == 1 && cL == 1
textLL = 'There are not Load Link; ';
NodoLoadLink = [];
rLL = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rLL,1);
for i=1:rLL
nome(i,1) = cellstr('Load Link');
end
NodoLoadLink = [nome Leggo(:,1) depth Leggo(:,3)];
% inverto la matrice Nodi (il primo nodo è il più profondo)
textLL = ['There are ',num2str(rLL),' Load Link nodes; '];
end
fprintf(fileID,fmt,textLL);
%% Klino Link
% carico le informazioni relative al numero e alla profondità per Klino Link
comando = ['select num, depth, measurment, channels from nodes where tool_id = ''' idTool ''' and nodetype_id = 26 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rKL,cL] = size(Leggo);
if rKL == 1 && cL == 1
textKL = 'There are not Klino Link; ';
NodoKlinoLink = [];
rKL = 0;
else
depth = Leggo(:,2);
nome = cell(rKL,1);
for i=1:rKL
nome(i,1) = cellstr('Klino Link');
end
NodoKlinoLink = [nome Leggo(:,1) depth Leggo(:,3) Leggo(:,4)];
textKL = ['There are ',num2str(rKL),' Klino Link nodes; '];
end
fprintf(fileID,fmt,textKL);
%% Klino Link HR
% carico le informazioni relative al numero e alla profondità per Klino
% Link HR
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 44 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rKLHR,cL] = size(Leggo);
if rKLHR == 1 && cL == 1
textKLHR = 'There are not Klino Link HR; ';
NodoKlinoLinkHR = [];
rKLHR = 0;
else
depth = Leggo(:,2);
nome = cell(rKLHR,1);
for i=1:rKLHR
nome(i,1) = cellstr('Klino Link HR');
end
NodoKlinoLinkHR = [nome Leggo(:,1) depth Leggo(:,3)];
textKLHR = ['There are ',num2str(rKLHR),' Klino Link HR nodes; '];
end
fprintf(fileID,fmt,textKLHR);
%% Rain Link
% carico le informazioni relative al numero e alla profondità per Rain Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 27 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rRL,cL] = size(Leggo);
if rRL == 1 && cL == 1
textRL = 'There are not Rain Link; ';
NodoRainLink = [];
rRL = 0;
else
nome = cell(rRL,1);
for i=1:rRL
nome(i,1) = cellstr('Rain Link');
end
NodoRainLink = [nome Leggo(:,1:3)];
textRL = ['There are ',num2str(rRL),' Rain Link nodes; '];
end
fprintf(fileID,fmt,textRL);
%% PT100 Link
% carico le informazioni relative al numero e alla profondità per PT100 Link
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 28 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rPT100,cL] = size(Leggo);
if rPT100 == 1 && cL == 1
textPT100 = 'There are not PT100 Link; ';
NodoPT100Link = [];
rPT100 = 0;
else
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rPT100,1);
for i=1:rPT100
nome(i,1) = cellstr('PT100 Link');
end
NodoPT100Link = [nome Leggo(:,1) depth];
textPT100 = ['There are ',num2str(rPT100),' PT100 Link nodes; '];
end
fprintf(fileID,fmt,textPT100);
%% In Place Link
% carico le informazioni relative al numero e alla profondità per In Place Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool...
''' and nodetype_id = 42 order by num'];
Leggo = fetch(conn,comando);
[rIPL,cL] = size(Leggo);
if rIPL <= 1 && cL <= 1
textIPL = 'There are not In Place Link; ';
NodoInPlaceLink = [];
nodoIPL = 0; % mi serve nei In Place Link HR 3D
rIPL = 0;
else
nodoIPL = 1; % mi serve nei In Place Link HR 3D
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rIPL,1);
for i=1:rIPL
nome(i,1) = cellstr('In Place Link');
end
NodoInPlaceLink = [nome Leggo(:,1) depth Leggo(:,3)];
textIPL = ['There are ',num2str(rIPL),' In Place Link nodes; '];
end
fprintf(fileID,fmt,textIPL);
%% In Place Link HR
% carico le informazioni relative al numero e alla profondità per In Place
% Link HR
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 43 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rIPLHR,cL] = size(Leggo);
if rIPLHR == 1 && cL == 1
textIPLHR = 'There are not In Place Link HR; ';
NodoInPlaceLinkHR = [];
nodoIPLHR = 0; % mi serve a riconoscere In Place Link HR 3D
rIPLHR = 0;
else
nodoIPLHR = 1; % mi serve a riconoscere In Place Link HR 3D
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rIPLHR,1);
for i=1:rIPLHR
nome(i,1) = cellstr('In Place Link HR');
end
NodoInPlaceLinkHR = [nome Leggo(:,1) depth Leggo(:,3)];
textIPLHR = ['There are ',num2str(rTLHR),' In Place Link HR nodes; '];
end
fprintf(fileID,fmt,textIPLHR);
% confrontando le profondità di Tilt Link e Tilt Link HR riconosco i TILT LINK HR 3D
if nodoIPL == 1 && nodoIPLHR == 1
NodoInPlaceLinkHR3Dwork = cell(rIPL,4); % creo matrice di zeri
p=1;
Control = 0;
for i=1:rIPL
for j=1:rIPLHR
if cell2mat(NodoInPlaceLink(i,3)) == cell2mat(NodoInPlaceLinkHR(j,3))
prof = NodoInPlaceLink(i,3);
nome = cellstr('In Place Link HR 3D');
% il numero nodo del In Place Link lo faccio diventare il numero nodo del In Place Link HR3D
num = NodoInPlaceLink(i,2);
num2 = NodoInPlaceLinkHR(j,2);
Leggo = [nome,num,num2,prof];
NodoInPlaceLinkHR3Dwork(p,:) = Leggo;
p = p+1;
Control = 1;
break
end
end
end
% elimino gli zeri in più
q = 1;
rCONT = 0;
[s,~] = size(NodoInPlaceLinkHR3Dwork);
a = 1;
while a == 1
if q > s
a = 0;
else
if strcmp(cell2mat(NodoInPlaceLinkHR3Dwork(q,1)),'In Place Link HR 3D')
rCONT = 1+rCONT; % ultima riga con dati che non siano celle vuote
end
end
q = q+1;
end
if Control == 1
NodoInPlaceLinkHR3D = NodoInPlaceLinkHR3Dwork(1:rCONT,:);
elseif Control == 0
NodoInPlaceLinkHR3D = [];
end
textIPL3D = ['There are ',num2str(rCONT),' In Place HR 3D nodes; '];
else
textIPL3D = 'There are not In Place HR 3D; ';
NodoInPlaceLinkHR3D = [];
end
rIPLHR3D = rCONT;
fprintf(fileID,fmt,textIPL3D);
%% Weir Link
% carico le informazioni relative al numero e alla profondità per Weir Link
comando = ['select num, depth, measurment, channels, therm from nodes where tool_id = ''' ...
idTool ''' and nodetype_id = 53 order by num'];
Leggo = fetch(conn,comando);
[rWL,cL] = size(Leggo);
if rWL <= 1 && cL <= 1
textWL = 'There are not Weir Link; ';
NodoWeirLink = [];
rWL = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rWL,1);
for i=1:rWL
nome(i,1) = cellstr('Weir Link');
end
NodoWeirLink = [nome Leggo(:,1) depth Leggo(:,3) Leggo(:,4) Leggo(:,5)];
textWL = ['There are ',num2str(rWL),' Weir Link nodes; '];
end
fprintf(fileID,fmt,textWL);
%% Pendulum
% carico le informazioni relative al numero e alla profondità per Pendulum
comando = ['select num, depth, measurment, channels from nodes where tool_id = ''' idTool...
''' and nodetype_id = 52 order by num'];
Leggo = fetch(conn,comando);
[rPE,cL] = size(Leggo);
if rPE <= 1 && cL <= 1
textPE = 'There are not Pendulums; ';
NodoPendulum = [];
rPE = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rPE,1);
for i=1:rPE
nome(i,1) = cellstr('Pendulum');
end
NodoPendulum = [nome Leggo(:,1) depth Leggo(:,3) Leggo(:,4)];
textPE = ['There are ',num2str(rPE),' Pendulum nodes; '];
end
fprintf(fileID,fmt,textPE);
%% Wind Link
% carico le informazioni relative al numero e alla profondità per Pendulum
comando = ['select num, depth, measurment, channels from nodes where tool_id = ''' idTool...
''' and nodetype_id = 55 order by num'];
Leggo = fetch(conn,comando);
[rWI,cL] = size(Leggo);
if rWI <= 1 && cL <= 1
textWI = 'There are not Wind Link; ';
NodoWind = [];
rWI = 0;
else
% cambio il segno della profondità (nel DB è positivo)
nome = cell(rWI,1);
for i=1:rWI
nome(i,1) = cellstr('Wind Link');
end
NodoWind = [nome Leggo(:,1) Leggo(:,3) Leggo(:,4)];
textWI = ['There are ',num2str(rWI),' Wind Link nodes; '];
end
fprintf(fileID,fmt,textWI);
%% Tilt Link HD VR
% carico le informazioni relative al numero e alla profondità per TILT LINK
comando = ['select num, depth, measurment, magnetometro from nodes where tool_id = ''' idTool...
''' and nodetype_id = 61 order by num'];
Leggo = fetch(conn,comando);
[rHDVR,cL] = size(Leggo);
if rHDVR <= 1 && cL <= 1
textHDVR = 'There are not Tilt Link HD VR; ';
NodoTiltLinkHDVR = [];
rHDVR = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rHDVR,1);
for i=1:rHDVR
nome(i,1) = cellstr('Tilt Link HD VR');
end
NodoTiltLinkHDVR = [nome Leggo(:,1) depth Leggo(:,3) Leggo(:,4)];
textHDVR = ['There are ',num2str(rHDVR),' Tilt Link HD VR nodes; '];
end
fprintf(fileID,fmt,textHDVR);
%% Tilt Link HD
comando = ['select num, depth, measurment, magnetometro from nodes where tool_id = ''' idTool...
''' and nodetype_id = 67 order by num'];
Leggo = fetch(conn,comando);
[rHD,cL] = size(Leggo);
if rHD <= 1 && cL <= 1
textHD = 'There are not Tilt Link HD; ';
NodoTiltLinkHD = [];
rHD = 0;
else
% cambio il segno della profondità (nel DB è positivo)
depth = (-1)*cell2mat(Leggo(:,2));
depth = num2cell(depth);
nome = cell(rHD,1);
for i=1:rHD
nome(i,1) = cellstr('Tilt Link HD');
end
NodoTiltLinkHD = [nome Leggo(:,1) depth Leggo(:,3) Leggo(:,4)];
textHD = ['There are ',num2str(rHD),' Tilt Link HD nodes; '];
end
fprintf(fileID,fmt,textHD);
%% Sensore Presenza Pioggia
% carico le informazioni relative al numero e alla profondità per SPP Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool...
''' and nodetype_id = 64 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rSPP,cSPP] = size(Leggo);
if rSPP == 1 && cSPP == 1
textSPP = 'There are not SPP Link; ';
NodoSPPLink = [];
rSPP = 0;
else
nome = cell(rSPP,1);
for i=1:rSPP
nome(i,1) = cellstr('SPP Link');
end
NodoSPPLink = [nome Leggo(:,1:3)];
textSPP = ['There are ',num2str(rSPP),' SPP Link nodes; '];
end
fprintf(fileID,fmt,textSPP);
%% Snow Link
% carico le informazioni relative al numero e alla profondità per Snow Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool...
''' and nodetype_id = 78 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[rSL,cL] = size(Leggo);
if rSL == 1 && cL == 1
textSL = 'There are not Snow Link; ';
NodoSnowLink = [];
rSL = 0;
else
nome = cell(rSL,1);
for i=1:rSL
nome(i,1) = cellstr('Snow Link');
end
NodoSnowLink = [nome Leggo(:,1:3)];
textSL = ['There are ',num2str(rSL),' Snow Link nodes; '];
end
fprintf(fileID,fmt,textSL);
text = 'tipologiaNodi function closed';
fprintf(fileID,fmt,text);
fclose(fileID);
end