Files
matlab-python/ATD/datainiziale.m

44 lines
1.4 KiB
Matlab
Executable File

% Funzione che scarica la data iniziale per quell'installazione
function [date,time,date_AC,time_AC,Nodo_AC,unitID] = datainiziale(DTcatena,...
unitID,conn,FileName)
text = 'datainiziale function started';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);
unitID = num2str(cell2mat(unitID));
comando = ['select prod_date from tools where unit_ID like ''' unitID ''' and name like ''' DTcatena ''' '];
data_ini = fetch(conn,comando);
stringa = cell2mat(data_ini);
[lS] = length(stringa);
date = stringa(1,1:10);
time = stringa(1,12:lS);
text = ['Starting date for the download of data: ' date ' ' time '. datainiziale function closed.'];
fprintf(fileID,fmt,text);
% Scarico la data iniziale per i nodi dell'arco rovescio
comando = ['select prod_date_node, node_num_prod from tools where unit_ID like ''' unitID ''' and name like ''' DTcatena ''' '];
dati = fetch(conn,comando);
stringa = cell2mat(dati(1,1));
[lS] = length(stringa);
if strcmp(stringa,'null')
date_AC = [];
time_AC = [];
Nodo_AC = [];
elseif strcmp(stringa,'No Data')
date_AC = [];
time_AC = [];
Nodo_AC = [];
else
date_AC = stringa(1,1:10);
time_AC = stringa(1,12:lS);
Nodo_AC = cell2mat(dati(1,2));
text = ['Starting date for the download of invert data related to Cir Array: ' date_AC ' ' time_AC '.'];
fprintf(fileID,fmt,text);
end
fclose(fileID);
end