Files
matlab-python/RSN/LastElab_bisSS.m

46 lines
1.7 KiB
Matlab
Executable File

function DatiElabShockSensor = LastElab_bisSS(conn,NodoShockSensor,rSS,datainiSS,...
tempoiniSS,IDcentralina,DTcatena,FileName)
text = 'LastElab_bisSS function started';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);
NShockSensor = cell2mat(NodoShockSensor(:,2));
NodeType = 'Shock Sensor';
ii = 1; % contatore
col = 3; % contatore colonne
while ii <= rSS
ini_col = col-2;
nN = num2str(NShockSensor(ii,1));
% Scarico di dati di spostamenti - giorno X
comando = ['select EventDate, EventTime, X from ElabDataView where EventDate = ''' ...
datainiSS ''' and EventTime >= ''' tempoiniSS ''' and UnitName = ''' IDcentralina ...
''' and ToolNameID = ''' DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
curs = exec(conn,comando);
curs = fetch(curs);
DATnodoSSd = curs.Data;
% Scarico di dati di spostamenti - giorni successivi a X
comando = ['select EventDate, EventTime, X from ElabDataView where EventDate >= ''' ...
datainiSS ''' and UnitName = ''' IDcentralina ''' and ToolNameID = ''' DTcatena ...
''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
curs = exec(conn,comando);
curs = fetch(curs);
DATnodoSS = curs.Data;
[~,c1] = size(DATnodoSS);
[~,c2] = size(DATnodoSSd);
if c1 == c2
DATnodoSS = [DATnodoSSd; DATnodoSS];
elseif c1 < c2 % solo giorno di riferimento
DATnodoSS = DATnodoSSd;
end
DatiElabShockSensor(:,ini_col:col) = DATnodoSS(:,:);
col = col+3;
ii = ii+1;
end
text = 'LastElab_bisSS function worked correctly';
fprintf(fileID,fmt,text);
fclose(fileID);
end