Files
matlab-python/Tilt/conv_grezziTLHRH.m

55 lines
1.4 KiB
Matlab
Executable File

% Funzione che converte i dati grezzi del Tilt Link HR H in dati di
% angoli (acc_TLHR)
function [angTLHRH,tempTLHRH] = conv_grezziTLHRH(angTLHRH,tempTLHRH,DCalTLHRHTot,rTLHRH,FileName)
text = 'conv_grezziTLHRH function started';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);
if DCalTLHRHTot(:,4) == 0 % Guadagno asse X e asse Y in comune
caTLHRH = DCalTLHRHTot(:,1);
caT_HRH = DCalTLHRHTot(:,2);
intT_HRH = DCalTLHRHTot(:,3);
XY = 1;
else
caTLHRH = [DCalTLHRHTot(:,1) DCalTLHRHTot(:,2)];
caT_HRH = DCalTLHRHTot(:,3);
intT_HRH = DCalTLHRHTot(:,4);
XY = 0;
end
i = 1;
m = 1;
c = 1;
% Contatore dei nodi, converte i punti ADC con le calibrazioni in valori
% angolari
while i <= 2*rTLHRH % nodo
if XY == 1
angTLHRH(:,i) = angTLHRH(:,i)*caTLHRH(m,1);
i = i+1;
if c == 2
m = m+1;
c = 1;
else
c = c+1;
end
else
angTLHRH(:,i) = angTLHRH(:,i)*caTLHRH(m,1);
angTLHRH(:,i+1) = angTLHRH(:,i+1)*caTLHRH(m,2);
i = i+2;
m = m+1;
end
end
%% Conversione delle temperature
for t = 1:rTLHRH
tempTLHRH(:,t) = tempTLHRH(:,t)*caT_HRH(t,1) + intT_HRH(t,1);
end
text = 'Raw Data of Tilt Link HR H converted into physical units correctly. conv_grezziTLHRH function ended';
fprintf(fileID,fmt,text);
fclose(fileID);
end