Files
matlab-python/Tilt/SWSearch.m

287 lines
9.3 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 [yesATD,yesRSN,yesMusa] = SWSearch(idTool,conn,FileName)
fileID = fopen(FileName,'a');
fmt = '%s \r';
text = 'SWSearch function started';
fprintf(fileID,fmt,text);
yesATD = 0;
yesRSN = 0;
yesMusa = 0;
%% 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 from nodes where tool_id = ''' idTool ''' and nodetype_id = 17 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Tunnel Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% 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 from nodes where tool_id = ''' idTool ''' and nodetype_id = 18 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Radial Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% 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 from nodes where tool_id = ''' idTool ''' and nodetype_id = 23 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'PreConv Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% 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);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'PreConv Links HR identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Pressure Link
% carico le informazioni relative al numero per Pressure LINK
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 21 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Pressure Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Load Link
% carico le informazioni relative al numero per LOAD LINK
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 15 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Load Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Extensometer Link
% carico le informazioni relative al numero per EXTENSOMETER LINK
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 16 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Extensometer Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% 3D Extensometer Link
% carico le informazioni relative al numero per 3D EXTENSOMETER LINK
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 19 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = '3D Extensometer Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Wire Extensometer Link
% carico le informazioni relative al numero per Wire EXTENSOMETER LINK
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 22 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Wire Extensometer Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Multi Point Borehole Rod Extensometer
% carico le informazioni relative al numero per Multi Point Borehole Rod Extensometer
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 25 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Multi-Point Rod Extensometers identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Crack Link
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 36 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Cracks Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% 2D Crack Link
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 51 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = '2D Cracks Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% 3D Crack Link
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 37 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = '3D Cracks Links identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Stress Meter
comando = ['select num, depth, channels, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 47 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesATD = 1;
text = 'Stress Meters identified, ATD relaunch activated';
fprintf(fileID,fmt,text);
end
%% Baro Musa Link
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 41 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesMusa = 1;
text = 'Baro Musa Links identified, Musa relaunch activated';
fprintf(fileID,fmt,text);
end
%% Humidity link
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 35 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesMusa = 1;
text = 'Humidity Links identified, Musa relaunch activated';
fprintf(fileID,fmt,text);
end
%% CO2 Link
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 33 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesMusa = 1;
text = 'CO2 Links identified, Musa relaunch activated';
fprintf(fileID,fmt,text);
end
%% Lux Link
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 34 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesMusa = 1;
text = 'Lux Links identified, Musa relaunch activated';
fprintf(fileID,fmt,text);
end
%% RSN Link
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 38 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesRSN = 1;
text = 'RSN Links identified, RSN relaunch activated';
fprintf(fileID,fmt,text);
end
%% RSN Link HR
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 39 order by num'];
Leggo = fetch(conn,comando);
[~,cL] = size(Leggo);
if cL > 1
yesRSN = 1;
text = 'RSN Links HR identified, RSN relaunch activated';
fprintf(fileID,fmt,text);
end
%% Trigger Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 40 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[~,cL] = size(Leggo);
if cL > 1
yesRSN = 1;
text = 'Trigger Links identified, RSN relaunch activated';
fprintf(fileID,fmt,text);
end
%% G-Flow Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 48 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[~,cL] = size(Leggo);
if cL > 1
yesRSN = 1;
text = 'G-Flow Links identified, RSN relaunch activated';
fprintf(fileID,fmt,text);
end
%% G-Shock Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 50 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[~,cL] = size(Leggo);
if cL > 1
yesRSN = 1;
text = 'G-Shock Links identified, RSN relaunch activated';
fprintf(fileID,fmt,text);
end
%% Debris Link
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 49 order by num'];
curs = exec(conn,comando);
curs = fetch(curs);
Leggo = curs.Data;
[~,cL] = size(Leggo);
if cL > 1
yesRSN = 1;
text = 'Debris Links identified, RSN relaunch activated';
fprintf(fileID,fmt,text);
end
text = 'SWSearch function ended';
fprintf(fileID,fmt,text);
fclose(fileID);
end