function yesMusa = SWSearch(idTool,conn,FileName)

fileID = fopen(FileName,'a');
fmt = '%s \r';
text = 'SWSearch function started';
fprintf(fileID,fmt,text);

yesMusa = 0;

%% 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

text = 'SWScheme function ended';
fprintf(fileID,fmt,text);
fclose(fileID);

end
