Sync from remote server: 2025-10-12 18:56:41
This commit is contained in:
61
RSN/azzeramenti.m
Executable file
61
RSN/azzeramenti.m
Executable file
@@ -0,0 +1,61 @@
|
||||
%% Funzione che corregge gli angoli di alcuni nodi specifici
|
||||
function angRSN = azzeramenti(conn,IDcentralina,DTcatena,angRSN,NodoRSNLink,ARRAYdateRSN,FileName)
|
||||
|
||||
fileID = fopen(FileName,'a');
|
||||
fmt = '%s \r';
|
||||
text = 'azzeramenti function started';
|
||||
fprintf(fileID,fmt,text);
|
||||
|
||||
NomeFile = strcat(IDcentralina,'-',DTcatena,'-','Azzeramenti.txt');
|
||||
if isfile(NomeFile) == 1
|
||||
Dati = importdata(NomeFile);
|
||||
if Dati(1,1) == 99999
|
||||
else
|
||||
[c,~] = size(Dati);
|
||||
i = 1;
|
||||
while i <= c
|
||||
if Dati(i,1) == 99999
|
||||
break
|
||||
else
|
||||
NodeType ='RSN Link';
|
||||
indice = Dati(i);
|
||||
|
||||
NodeNumRSN = num2str(cell2mat(NodoRSNLink(indice,2)));
|
||||
dataRIF = num2str(ARRAYdateRSN(end)-7);
|
||||
comando = ['select AlfaX, AlfaY from ElabDataView where EventDate >= ''' ...
|
||||
dataRIF ''' and UnitName = ''' IDcentralina ...
|
||||
''' and ToolNameID = ''' DTcatena ''' and NodeType = ''' NodeType ...
|
||||
''' and NodeNum =' NodeNumRSN ' '];
|
||||
curs = exec(conn,comando);
|
||||
curs = fetch(curs);
|
||||
Riferimento = curs.Data;
|
||||
|
||||
angRSN(:,2*indice-1:2*indice) = Riferimento(end,1:2);
|
||||
text = ['Node RSN Link number ' NodeNumRSN ' has been corrected by azzeramenti function'];
|
||||
fprintf(fileID,fmt,text);
|
||||
i=i+1;
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
fclose(fileID);
|
||||
Parametro1 = 99999;
|
||||
Parametro2 = 999999999;
|
||||
outdat = fopen(NomeFile,'wt+');
|
||||
fopen(NomeFile,'wt');
|
||||
fmt = '%d \r';
|
||||
fileA = fopen(NomeFile,'a');
|
||||
fprintf(fileA,fmt,Parametro1);
|
||||
fprintf(fileA,fmt,Parametro2);
|
||||
fclose(fileA);
|
||||
|
||||
fileID = fopen(FileName,'a');
|
||||
fmt = '%s \r';
|
||||
text = 'azzeramenti function created the reference file correctly';
|
||||
fprintf(fileID,fmt,text);
|
||||
end
|
||||
|
||||
text = 'azzeramenti function executed correctly';
|
||||
fprintf(fileID,fmt,text);
|
||||
fclose(fileID);
|
||||
end
|
||||
Reference in New Issue
Block a user