Sync from remote server: 2025-10-12 18:56:41
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
home/*
|
||||||
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.9
|
||||||
999
ATD/ATD_Dati.m
Executable file
999
ATD/ATD_Dati.m
Executable file
@@ -0,0 +1,999 @@
|
|||||||
|
function RC = ATD_Dati(IDcentralina,DTcatena)
|
||||||
|
%%% Programma per l'elaborazione dei dati di Cir Array, Rad Array, Tilt
|
||||||
|
%%% Link H, Tilt Link HR H, PreConv Array, PreConv Array HR e strumenti
|
||||||
|
%%% analogici per gallerie.
|
||||||
|
%%% Versione 3.4
|
||||||
|
|
||||||
|
tic
|
||||||
|
|
||||||
|
RC = 1; %#ok<NASGU>
|
||||||
|
text = ['Elaboration of chain ' DTcatena ' of control unit ' IDcentralina ' started correctly'];
|
||||||
|
d = datestr(datetime,'yyyy_mm_dd');
|
||||||
|
t = datestr(datetime,'HH_MM_SS');
|
||||||
|
FileName = ['LogFile-' IDcentralina '-' DTcatena '-' d '-' t '.txt'];
|
||||||
|
outdat = fopen(FileName,'wt+'); %#ok<NASGU>
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
%% Parte generale
|
||||||
|
|
||||||
|
% Associo ID company al relativo DB
|
||||||
|
% Definisco i parametri del Database
|
||||||
|
IDcompany = '1'; % DA INTEGRARE IN VERSIONI FUTURE
|
||||||
|
DB = database_definition(IDcompany,FileName);
|
||||||
|
|
||||||
|
% Apro la connessione al DB
|
||||||
|
dbname = cell2mat(DB{1,1});
|
||||||
|
username = cell2mat(DB{2,1});
|
||||||
|
password = cell2mat(DB{3,1});
|
||||||
|
driver = cell2mat(DB{4,1});
|
||||||
|
dburl = cell2mat(DB{5,1});
|
||||||
|
conn = database(dbname, username, password, driver, dburl);
|
||||||
|
|
||||||
|
% scarico Contol Unit ID
|
||||||
|
unitID = IDunit(IDcentralina,conn,FileName);
|
||||||
|
|
||||||
|
% questa funzione considera la prima data e ora da cui caricare i dati a seconda della catena
|
||||||
|
[date,time,date_AC,time_AC,Nodo_AC,unitID] = datainiziale(DTcatena,unitID,conn,FileName);
|
||||||
|
|
||||||
|
% funzione che elenca tutti i nodi ed il loro numero presenti per ogni tipo di sensore.
|
||||||
|
[idTool,NodoTunnelLink,NodoRadialLink,NodoTiltLinkH,...
|
||||||
|
NodoTiltLinkHRH,NodoPreConvLink,NodoPreConvLinkHR,NodoPressureLink,...
|
||||||
|
NodoLoadLink,NodoExtensometerLink,Nodo3DExtensometerLink,NodoWireExtensometerLink,...
|
||||||
|
NodoMultiPointRodExtensometer,NodoTiltLinkHR3DH,NodoPreConvLinkHR3D,...
|
||||||
|
NodoAnalogLink,NodoCrackLink,Nodo3DCrackLink,Nodo2DCrackLink,NodoStressMeter,...
|
||||||
|
rTuL,rRL,rTLH,rTLHRH,rPCL,rPCLHR,rPrL,rLL,rEL,r3DEL,rWEL,rMPBEL,rAL,rCrL,r3DCrL,...
|
||||||
|
r2DCrL,rSM,~,~] = tipologiaNodi(DTcatena,unitID,conn,FileName);
|
||||||
|
|
||||||
|
% funzione che ricostruisce i nodi della catena
|
||||||
|
catena = schema(idTool,conn,FileName);
|
||||||
|
|
||||||
|
% funzione che attiva/disattiva l'elaborazione per una determinata tipologia di nodo
|
||||||
|
[yesTuL,yesRL,yesTLH,yesTLHRH,~,yesPCL,yesPCLHR,~,yesPL,yesLL,...
|
||||||
|
yesEL,yes3DEL,yesWEL,yesMPBEL,yesAL,yesCrL,yes3DCrL,yes2DCrL,yesSM] = ...
|
||||||
|
YesNo(NodoTunnelLink,NodoRadialLink,NodoTiltLinkH,NodoTiltLinkHRH,...
|
||||||
|
NodoTiltLinkHR3DH,NodoPreConvLink,NodoPreConvLinkHR,NodoPreConvLinkHR3D,...
|
||||||
|
NodoPressureLink,NodoLoadLink,NodoExtensometerLink,Nodo3DExtensometerLink,...
|
||||||
|
NodoWireExtensometerLink,NodoMultiPointRodExtensometer,NodoAnalogLink,...
|
||||||
|
NodoCrackLink,Nodo3DCrackLink,Nodo2DCrackLink,NodoStressMeter,FileName);
|
||||||
|
|
||||||
|
% Definisco i parametri di elaborazione di un'installazione
|
||||||
|
[NdatiMedia,Ndatidespike,MEMS,tolleranzaAcc,Tmax,Tmin,Ndevst,Wdevst,...
|
||||||
|
Ndevst_HR,Wdevst_HR,NumBasi,elab_option] = Parametri_Installazione(idTool,...
|
||||||
|
conn,yesTuL,yesRL,yesTLH,yesTLHRH,yesPCL,yesPCLHR,yesMPBEL,yesWEL,FileName);
|
||||||
|
|
||||||
|
% funzione che ricostruisce segmenti di pertinenza etc
|
||||||
|
[SpeTuL,SpeRL,SpeTLH,PsTLH,SpeTLHRH,PsTLHRH,SpePCL,SpePCLHR]...
|
||||||
|
= schemaSP(yesTuL,yesRL,yesTLH,yesTLHRH,yesPCL,yesPCLHR,...
|
||||||
|
NodoTunnelLink,NodoRadialLink,NodoTiltLinkH,NodoTiltLinkHRH,...
|
||||||
|
NodoPreConvLink,NodoPreConvLinkHR,rTuL,rRL,rTLH,rTLHRH,rPCL,rPCLHR,catena,FileName);
|
||||||
|
|
||||||
|
%% Scarico dei dati
|
||||||
|
|
||||||
|
% funzione che carica i dati di calibrazione
|
||||||
|
[DCalTuLTot,DCalRLTot,DCalTLHTot,DCalTLHRHTot,DCalPCLTot,DCalPCLHRTot,...
|
||||||
|
DCalPLTot,DCalLLTot,DCalELTot,DCalEL3DTot,DCalWELTot,DCalMPBELTot,...
|
||||||
|
DCalALTot,DCalCrLTot,DCal3DCrLTot,DCal2DCrLTot,DCalSMTot,yesTuL,yesRL,yesTLH,yesTLHRH,...
|
||||||
|
yesPCL,yesPCLHR,yesPL,yesLL,yesEL,yes3DEL,yesWEL,yesMPBEL,yesCrL,yes3DCrL,yes2DCrL,...
|
||||||
|
yesAL,yesSM] = letturaCal(IDcentralina,DTcatena,catena,rTuL,rRL,rTLH,rTLHRH,...
|
||||||
|
rPCL,rPCLHR,rPrL,rLL,rEL,r3DEL,rWEL,rMPBEL,NumBasi,rAL,rCrL,r3DCrL,r2DCrL,rSM,...
|
||||||
|
NodoTunnelLink,NodoRadialLink,NodoTiltLinkH,NodoPreConvLink,NodoPressureLink,...
|
||||||
|
NodoLoadLink,NodoExtensometerLink,Nodo3DExtensometerLink,...
|
||||||
|
NodoWireExtensometerLink,NodoMultiPointRodExtensometer,NodoAnalogLink,...
|
||||||
|
NodoCrackLink,Nodo3DCrackLink,Nodo2DCrackLink,NodoStressMeter,yesTuL,yesRL,yesTLH,yesTLHRH,...
|
||||||
|
yesPCL,yesPCLHR,yesPL,yesLL,yesEL,yes3DEL,yesWEL,yesMPBEL,yesAL,yesCrL,yes3DCrL,yes2DCrL,...
|
||||||
|
yesSM,conn,FileName);
|
||||||
|
|
||||||
|
% Reinizializzazione scarico dati
|
||||||
|
[NuovoZeroTuL,NuovoZeroRL,NuovoZeroTLH,NuovoZeroTLHRH,NuovoZeroPCL,...
|
||||||
|
NuovoZeroPCLHR,NuovoZeroAL,NuovoZeroPrL,NuovoZeroLL,NuovoZeroEL,NuovoZero3DEL,...
|
||||||
|
NuovoZeroWEL,NuovoZeroMPBEL,NuovoZeroCrL,NuovoZero2DCrL,NuovoZero3DCrL,NuovoZeroSM,...
|
||||||
|
DatiElabTunnelLink,DatiElabRadialLink,DatiElabTiltLinkH,DatiElabTiltLinkHRH,...
|
||||||
|
DatiElabPreConvLink,DatiElabPreConvLinkHR,...
|
||||||
|
datainiTuL,datainiRL,datainiTLH,datainiTLHRH,datainiPCL,datainiPCLHR,...
|
||||||
|
tempoiniTuL,tempoiniRL,tempoiniTLH,tempoiniTLHRH,tempoiniPCL,tempoiniPCLHR,...
|
||||||
|
datainiPL,datainiLL,datainiEL,dataini3DEL,datainiWEL,datainiCrL,dataini2DCrL,...
|
||||||
|
dataini3DCrL,datainiAL,datainiMPBEL,datainiPrL,datainiSM,tempoiniPL,tempoiniLL,...
|
||||||
|
tempoiniEL,tempoini3DEL,tempoiniWEL,tempoiniCrL,tempoini2DCrL,tempoini3DCrL,tempoiniAL,...
|
||||||
|
tempoiniMPBEL,tempoiniPrL,tempoiniSM,DatiElabAnalogLink,Date_Rif_EL,Date_Rif_3DEL,...
|
||||||
|
Date_Rif_SM,ay_TuL,ay_TuL_AC,t_TuL_AC,t_TuL,data1_AC] = scarico(date,time);
|
||||||
|
|
||||||
|
if strcmp(IDcentralina,'ID0142') == 1 && strcmp(DTcatena,'DT0173')
|
||||||
|
[DatiTunnelLink,ErrTunnelLink,DatiRadialLink,ErrRadialLink,DatiTiltLinkH,ErrTiltLinkH,datainiTLH,...
|
||||||
|
DatiTiltLinkHRH,ErrTiltLinkHRH,DatiPreConvLink,ErrPreConvLink,DatiPreConvLinkHR,ErrPreConvLinkHR,...
|
||||||
|
DatiPressureLink,ErrPressureLink,DatiLoadLink,ErrLoadLink,DatiExtensometerLink,DatiNTCExtensometerLink,...
|
||||||
|
ErrExtensometerLink,Dati3DExtensometerLink,DatiNTC3DExtensometerLink,Err3DExtensometerLink,...
|
||||||
|
DatiWireExtensometerLink,DatiNTCWireExtensometerLink,ErrWireExtensometerLink,...
|
||||||
|
DatiMultiPointExtensometer,DatiNTCMultiPointExtensometer,ErrMultiPointExtensometer,...
|
||||||
|
DatiAnalogLink,ErrAnalogLink,DatiCrackLink,DatiNTCCrackLink,ErrCrackLink,Dati3DCrackLink,DatiNTC3DCrackLink,...
|
||||||
|
Err3DCrackLink,Dati2DCrackLink,DatiNTC2DCrackLink,Err2DCrackLink,DatiStressMeter,DatiNTCStressMeter,...
|
||||||
|
ErrStressMeter,yesTLH,ChEL,EL_NTC,Ch3DEL,EL3D_NTC,ChWEL,WEL_NTC,~,~,~,~,ChCrL,CrL_NTC,...
|
||||||
|
Ch3DCrL,CrL3D_NTC,Ch2DCrL,CrL2D_NTC,ChSM,SM_NTC,Batteria] = letturaHybrid(IDcentralina,DTcatena,datainiTLH,tempoiniTLH,...
|
||||||
|
NodoTiltLinkH,NuovoZeroTLH,yesTLH,rTLH,date,time,catena,conn,FileName);
|
||||||
|
else
|
||||||
|
% Lettura dati da DB
|
||||||
|
[Batteria,DatiTunnelLink,ErrTunnelLink,datainiTuL,...
|
||||||
|
DatiRadialLink,ErrRadialLink,datainiRL,DatiTiltLinkH,ErrTiltLinkH,datainiTLH,...
|
||||||
|
DatiTiltLinkHRH,ErrTiltLinkHRH,datainiTLHRH,DatiPreConvLink,ErrPreConvLink,datainiPCL,...
|
||||||
|
DatiPreConvLinkHR,ErrPreConvLinkHR,datainiPCLHR,DatiPressureLink,ErrPressureLink,...
|
||||||
|
DatiLoadLink,ErrLoadLink,DatiExtensometerLink,DatiExtensometerLink_Rif,...
|
||||||
|
DatiNTCExtensometerLink,ErrExtensometerLink,Dati3DExtensometerLink,ChEL,EL_NTC,...
|
||||||
|
Dati3DExtensometerLink_Rif,DatiNTC3DExtensometerLink,Err3DExtensometerLink,ErrNTC3DExtensometerLink,Ch3DEL,EL3D_NTC,...
|
||||||
|
DatiWireExtensometerLink,DatiNTCWireExtensometerLink,ErrWireExtensometerLink,ChWEL,WEL_NTC,...
|
||||||
|
DatiMultiPointExtensometer,DatiNTCMultiPointExtensometer,ErrMultiPointExtensometer,ErrNTCMultiPointExtensometer,~,~,...
|
||||||
|
DatiAnalogLink,ErrAnalogLink,datainiAL,~,~,...
|
||||||
|
DatiCrackLink,DatiNTCCrackLink,ErrCrackLink,ChCrL,CrL_NTC,...
|
||||||
|
Dati3DCrackLink,DatiNTC3DCrackLink,Err3DCrackLink,ErrNTC3DCrackLink,Ch3DCrL,CrL3D_NTC,...
|
||||||
|
Dati2DCrackLink,DatiNTC2DCrackLink,Err2DCrackLink,ErrNTC2DCrackLink,Ch2DCrL,CrL2D_NTC,...
|
||||||
|
DatiStressMeter,DatiStressMeter_Rif,DatiNTCStressMeter,DatiNTCStressMeter_Rif,ErrStressMeter,ChSM,SM_NTC,...
|
||||||
|
yesTuL,yesRL,yesTLH,yesTLHRH,yesPCL,yesPCLHR,yesPL,yesLL,yesEL,yes3DEL,...
|
||||||
|
yesWEL,yesMPBEL,yesAL,yesCrL,yes3DCrL,yes2DCrL,yesSM] = ...
|
||||||
|
lettura_Dati(IDcentralina,DTcatena,datainiTuL,tempoiniTuL,NodoTunnelLink,NuovoZeroTuL,date_AC,time_AC,Nodo_AC,...
|
||||||
|
datainiRL,tempoiniRL,NodoRadialLink,NuovoZeroRL,datainiTLH,tempoiniTLH,NodoTiltLinkH,NuovoZeroTLH,...
|
||||||
|
datainiTLHRH,tempoiniTLHRH,NodoTiltLinkHRH,NuovoZeroTLHRH,datainiPCL,tempoiniPCL,NodoPreConvLink,NuovoZeroPCL,...
|
||||||
|
datainiPCLHR,tempoiniPCLHR,NodoPreConvLinkHR,NuovoZeroPCLHR,datainiPL,tempoiniPL,NodoPressureLink,NuovoZeroPrL,...
|
||||||
|
datainiLL,tempoiniLL,NodoLoadLink,NuovoZeroLL,datainiEL,tempoiniEL,Date_Rif_EL,NodoExtensometerLink,NuovoZeroEL,...
|
||||||
|
dataini3DEL,tempoini3DEL,Date_Rif_3DEL,Nodo3DExtensometerLink,NuovoZero3DEL,...
|
||||||
|
datainiWEL,tempoiniWEL,NodoWireExtensometerLink,NuovoZeroWEL,...
|
||||||
|
datainiMPBEL,tempoiniMPBEL,NodoMultiPointRodExtensometer,NuovoZeroMPBEL,...
|
||||||
|
datainiAL,tempoiniAL,NodoAnalogLink,NumBasi,NuovoZeroAL,...
|
||||||
|
datainiCrL,tempoiniCrL,NodoCrackLink,NuovoZeroCrL,dataini3DCrL,tempoini3DCrL,Nodo3DCrackLink,NuovoZero3DCrL,...
|
||||||
|
dataini2DCrL,tempoini2DCrL,Nodo2DCrackLink,NuovoZero2DCrL,...
|
||||||
|
datainiSM,tempoiniSM,Date_Rif_SM,NodoStressMeter,NuovoZeroSM,yesTuL,yesRL,yesTLH,...
|
||||||
|
yesTLHRH,yesPCL,yesPCLHR,yesPL,yesLL,yesEL,yes3DEL,yesWEL,yesMPBEL,yesAL,yesCrL,...
|
||||||
|
yes3DCrL,yes2DCrL,yesSM,rTuL,rRL,rTLH,rTLHRH,rPCL,rPCLHR,rPrL,...
|
||||||
|
rLL,rEL,r3DEL,rWEL,rMPBEL,rAL,rCrL,r3DCrL,r2DCrL,rSM,conn,catena,date,time,FileName);
|
||||||
|
end
|
||||||
|
|
||||||
|
% Centralina
|
||||||
|
[DATA,Tcentralina] = centralina(IDcentralina,DTcatena,catena,datainiTuL,tempoiniTuL,...
|
||||||
|
datainiRL,tempoiniRL,datainiTLH,tempoiniTLH,datainiTLHRH,tempoiniTLHRH,...
|
||||||
|
datainiPCL,tempoiniPCL,datainiPCLHR,tempoiniPCLHR,datainiLL,tempoiniLL,datainiPrL,...
|
||||||
|
tempoiniPrL,datainiEL,tempoiniEL,dataini3DEL,tempoini3DEL,datainiWEL,tempoiniWEL,...
|
||||||
|
datainiCrL,tempoiniCrL,dataini3DCrL,tempoini3DCrL,datainiMPBEL,tempoiniMPBEL,conn);
|
||||||
|
|
||||||
|
DataLogger = [DATA cell2mat(Batteria(:,3)) cell2mat(Tcentralina(:,3))];
|
||||||
|
xlswrite('Dati.xlsx',DataLogger,1);
|
||||||
|
|
||||||
|
%% Parte di definizione dati, conversione in unità fisiche e calcolo medie
|
||||||
|
|
||||||
|
% --- Tunnel Link ---
|
||||||
|
if yesTuL == 1 % attiva l'elaborazione dei Tunnel Link
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeTuL,accTuL,magTuL,tempTuL,ay_TuL,ay_TuL_AC,ErrTunnelLink] = defDatiTuL_Dati(...
|
||||||
|
DatiTunnelLink,ay_TuL,ay_TuL_AC,Ndatidespike,rTuL,NuovoZeroTuL,ErrTunnelLink,...
|
||||||
|
MEMS,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[accTuL,ris_acc_TuL,magTuL,ris_mag_TuL,T_TuL,ay_TuL,ay_TuL_AC] = conv_grezziTuL(...
|
||||||
|
rTuL,accTuL,magTuL,tempTuL,DCalTuLTot,ay_TuL,t_TuL,ay_TuL_AC,t_TuL_AC,...
|
||||||
|
NuovoZeroTuL,MEMS,FileName);
|
||||||
|
xlswrite('Dati.xlsx',accTuL,4);
|
||||||
|
xlswrite('Dati.xlsx',magTuL,5);
|
||||||
|
xlswrite('Dati.xlsx',ris_acc_TuL,6);
|
||||||
|
xlswrite('Dati.xlsx',ris_mag_TuL,7);
|
||||||
|
xlswrite('Dati.xlsx',T_TuL,8);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_TuL,accTuL,ACCdefRis_TuL,TempDef_TuL,ay_TuL,ay_TuL_AC] = ...
|
||||||
|
MediaDati_TuL(accTuL,TimeTuL,ris_acc_TuL,ay_TuL,ay_TuL_AC,NdatiMedia,...
|
||||||
|
T_TuL,NuovoZeroTuL,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_TuL = [];
|
||||||
|
text = 'There are not data to convert for Tunnel Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiTunnelLink
|
||||||
|
clear tempTuL
|
||||||
|
clear DCalTuLTot
|
||||||
|
clear t_TuL
|
||||||
|
clear t_TuL_AC
|
||||||
|
clear ris_acc_TuL
|
||||||
|
clear T_TuL
|
||||||
|
clear TimeTuL
|
||||||
|
|
||||||
|
% --- Radial Link ---
|
||||||
|
if yesRL == 1 % attiva l'elaborazione dei Radial Link
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeRL,accRL,tempRL,ErrRadialLink] = defDatiRL(DatiRadialLink,...
|
||||||
|
ErrRadialLink,Ndatidespike,rRL,MEMS,FileName);
|
||||||
|
xlswrite('Dati.xlsx',accRL,2);
|
||||||
|
xlswrite('Dati.xlsx',magRL,3);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[accRL,ris_acc_RL,T_RL] = conv_grezziRL(rRL,accRL,tempRL,DCalRLTot,MEMS,FileName);
|
||||||
|
xlswrite('Dati.xlsx',accRL,4);
|
||||||
|
xlswrite('Dati.xlsx',magRL,5);
|
||||||
|
xlswrite('Dati.xlsx',ris_acc_RL,6);
|
||||||
|
xlswrite('Dati.xlsx',ris_mag_RL,7);
|
||||||
|
xlswrite('Dati.xlsx',T_RL,8);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_RL,accRL,ACCdefRis_RL,TempDef_RL] = MediaDati_RL(accRL,...
|
||||||
|
TimeRL,ris_acc_RL,NdatiMedia,T_RL,FileName);
|
||||||
|
else
|
||||||
|
text = 'There are not data to convert for Radial Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
ARRAYdate_RL = [];
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiRadialLink
|
||||||
|
clear tempRL
|
||||||
|
clear DCalRLTot
|
||||||
|
clear ris_acc_RL
|
||||||
|
clear T_RL
|
||||||
|
clear TimeRL
|
||||||
|
|
||||||
|
% --- Tilt Link H ---
|
||||||
|
if yesTLH == 1 % attiva l'elaborazione dei Tilt Link H
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeTLH,accTLH,tempTLH,ErrTiltLinkH] = defDatiTLH(...
|
||||||
|
DatiTiltLinkH,ErrTiltLinkH,Ndatidespike,rTLH,MEMS,FileName);
|
||||||
|
xlswrite('Dati.xlsx',accTLH,2);
|
||||||
|
xlswrite('Dati.xlsx',magTLH,3);
|
||||||
|
% conversione dei dati grezzi
|
||||||
|
[accTLH,ris_acc_TLH,tempTLH,ErrTiltLinkH] = conv_grezziTLH(rTLH,...
|
||||||
|
accTLH,tempTLH,DCalTLHTot,ErrTiltLinkH,MEMS,FileName);
|
||||||
|
xlswrite('Dati.xlsx',accTLH,4);
|
||||||
|
xlswrite('Dati.xlsx',magTLH,5);
|
||||||
|
xlswrite('Dati.xlsx',ris_acc_TLH,6);
|
||||||
|
xlswrite('Dati.xlsx',ris_mag_TLH,7);
|
||||||
|
xlswrite('Dati.xlsx',T_TLH,8);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_TLH,accTLH,ACCdefRis_TLH,TempDef_TLH] = MediaDati_TLH(...
|
||||||
|
accTLH,TimeTLH,ris_acc_TLH,NdatiMedia,tempTLH,FileName);
|
||||||
|
else
|
||||||
|
text = 'There are not data to convert for Tilt Link H';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
ARRAYdate_TLH = [];
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiTiltLinkH
|
||||||
|
clear tempTLH
|
||||||
|
clear DCalTLHTot
|
||||||
|
clear ris_acc_TLH
|
||||||
|
clear T_TLH
|
||||||
|
clear TimeTLH
|
||||||
|
|
||||||
|
% --- Tilt Link HR H ---
|
||||||
|
if yesTLHRH == 1 % attiva l'elaborazione dei Tilt Link HR H
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeTLHRH,angTLHRH,tempTLHRH,ErrTiltLinkHRH] = defDatiTLHRH(...
|
||||||
|
DatiTiltLinkHRH,ErrTiltLinkHRH,Ndatidespike,NodoTiltLinkHRH,rTLHRH,...
|
||||||
|
IDcentralina,DTcatena,FileName);
|
||||||
|
% conversione dei dati grezzi
|
||||||
|
[angTLHRH,tempTLHRH] = conv_grezziTLHRH(angTLHRH,tempTLHRH,DCalTLHRHTot,...
|
||||||
|
rTLHRH,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_TLHRH,AngDef_TLHRH,TempDef_TLHRH] = MediaDati_TLHRH(angTLHRH,...
|
||||||
|
TimeTLHRH,NdatiMedia,tempTLHRH,FileName);
|
||||||
|
else
|
||||||
|
text = 'There are not data to convert for Tilt Link HR H';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
ARRAYdate_TLHRH = [];
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiTiltLinkHRH
|
||||||
|
clear tempTLHRH
|
||||||
|
clear DCalTLHRHTot
|
||||||
|
clear ang_TLHRH
|
||||||
|
clear TimeTLHRH
|
||||||
|
|
||||||
|
% --- PreConv Link ---
|
||||||
|
if yesPCL == 1 % attiva l'elaborazione dei PreConv Link
|
||||||
|
% definizione dei dati
|
||||||
|
[TimePCL,accPCL,tempPCL,ErrPreConvLink] = defDatiPCL(DatiPreConvLink,...
|
||||||
|
ErrPreConvLink,Ndatidespike,rPCL,MEMS,FileName);
|
||||||
|
xlswrite('Dati.xlsx',accPCL,2);
|
||||||
|
xlswrite('Dati.xlsx',magPCL,3);
|
||||||
|
% conversione dei dati grezzi
|
||||||
|
[accPCL,ris_acc_PCL,T_PCL] = conv_grezziPCL(rPCL,accPCL,tempPCL,DCalPCLTot,...
|
||||||
|
MEMS,FileName);
|
||||||
|
xlswrite('Dati.xlsx',accPCL,4);
|
||||||
|
xlswrite('Dati.xlsx',magPCL,5);
|
||||||
|
xlswrite('Dati.xlsx',ris_acc_PCL,6);
|
||||||
|
xlswrite('Dati.xlsx',ris_mag_PCL,7);
|
||||||
|
xlswrite('Dati.xlsx',T_PCL,8);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_PCL,accPCL,ACCdefRis_PCL,TempDef_PCL] = MediaDati_PCL(...
|
||||||
|
accPCL,TimePCL,ris_acc_PCL,NdatiMedia,T_PCL,FileName);
|
||||||
|
else
|
||||||
|
text = 'There are not data to convert for PreConv Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
ARRAYdate_PCL = [];
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiPreConvLink
|
||||||
|
clear tempPCL
|
||||||
|
clear TimePCL
|
||||||
|
clear DCalPCLTot
|
||||||
|
clear ris_acc_PCL
|
||||||
|
clear T_PCL
|
||||||
|
|
||||||
|
% --- PreConv Link HR ---
|
||||||
|
if yesPCLHR == 1 % attiva l'elaborazione dei PreConv Link HR
|
||||||
|
% definizione dei dati
|
||||||
|
[TimePCLHR,angPCLHR,tempPCLHR,ErrPreConvLinkHR] = defDatiPCLHR(...
|
||||||
|
DatiPreConvLinkHR,ErrPreConvLinkHR,NodoPreConvLinkHR,Ndatidespike,rPCLHR,...
|
||||||
|
IDcentralina,DTcatena,FileName);
|
||||||
|
% conversione dei dati grezzi
|
||||||
|
[angPCLHR,tempPCLHR] = conv_grezziPCLHR(angPCLHR,tempPCLHR,DCalPCLHRTot,...
|
||||||
|
rPCLHR,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_PCLHR,AngDef_PCLHR,TempDef_PCLHR] = MediaDati_PCLHR(...
|
||||||
|
angPCLHR,TimePCLHR,NdatiMedia,tempPCLHR,FileName);
|
||||||
|
else
|
||||||
|
text = 'There are not data to convert for PreConv Link HR';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
ARRAYdate_PCLHR = [];
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiPreConvLinkHR
|
||||||
|
clear angPCLHR
|
||||||
|
clear tempPCLHR
|
||||||
|
clear DCalPCLHRTot
|
||||||
|
clear T_PCLHR
|
||||||
|
clear TimePCLHR
|
||||||
|
|
||||||
|
% --- Pressure Link ---
|
||||||
|
if yesPL == 1 % arriva l'elaborazione dei Pressure Link
|
||||||
|
% definizione dei dati
|
||||||
|
[TimePL,Pressure,ErrPressureLink] = defDatiPL(DatiPressureLink,...
|
||||||
|
ErrPressureLink,Ndatidespike,rPrL,FileName);
|
||||||
|
% conversione dei dati grezzi
|
||||||
|
DatiPressure = conv_grezziPL(Pressure,DCalPLTot,NodoPressureLink,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_PL,DatiPressure] = MediaDati_PL(DatiPressure,TimePL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_PL = [];
|
||||||
|
DatiPressure = [];
|
||||||
|
text = 'There are not data to convert for Pressure Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiPressureLink
|
||||||
|
clear TimePL
|
||||||
|
clear Pressure
|
||||||
|
clear DCalPLTot
|
||||||
|
|
||||||
|
% --- Load Link ---
|
||||||
|
if yesLL == 1 % attiva l'elaborazione dei Load Link
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeLL,Load,ErrLoadLink] = defDatiLL(DatiLoadLink,ErrLoadLink,...
|
||||||
|
Ndatidespike,rLL,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
DatiLoad = conv_grezziLL(Load,DCalLLTot,NodoLoadLink,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_LL,DatiLoad] = MediaDati_LL(DatiLoad,TimeLL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_LL = [];
|
||||||
|
DatiLoad = [];
|
||||||
|
text = 'There are not data to convert for Load Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiLoadLink
|
||||||
|
clear TimeLL
|
||||||
|
clear Load
|
||||||
|
clear DCalLLTot
|
||||||
|
|
||||||
|
% --- Extensometer Link ---
|
||||||
|
if yesEL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeEL,Extensometer,NTCExtensometer,ErrExtensometerLink]...
|
||||||
|
= defDatiEL(DatiExtensometerLink,DatiNTCExtensometerLink,ErrExtensometerLink,...
|
||||||
|
ChEL,EL_NTC,rEL,Ndatidespike,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[DatiExtensometer,DatiExtensometer_Rif,DatiNTCExtensometer,ErrExtensometerLink]...
|
||||||
|
= conv_grezziEL(Extensometer,NTCExtensometer,DatiExtensometerLink_Rif,DCalELTot,EL_NTC,...
|
||||||
|
NodoExtensometerLink,ErrExtensometerLink,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_EL,DatiExtensometer] = MediaDati_EL(DatiExtensometer,TimeEL,NdatiMedia,FileName);
|
||||||
|
% Sottraggo la misura di riferimento
|
||||||
|
DatiExtensometer = DatiExtensometer - DatiExtensometer_Rif(1,:);
|
||||||
|
else
|
||||||
|
ARRAYdate_EL = [];
|
||||||
|
DatiExtensometer = [];
|
||||||
|
DatiNTCExtensometer = [];
|
||||||
|
text = 'There are not data to convert for Extensometer Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiExtensometerLink
|
||||||
|
clear DatiNTCExtensometerLink
|
||||||
|
clear DatiExtensometerLink_Rif
|
||||||
|
clear TimeEL
|
||||||
|
clear Extensometer
|
||||||
|
clear NTCExtensometer
|
||||||
|
clear DCalELTot
|
||||||
|
clear DatiExtensometer_Rif
|
||||||
|
|
||||||
|
% --- 3D Extensometer Link ---
|
||||||
|
if yes3DEL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[Time3DEL,Extensometer3D,Extensometer3D_Rif,NTCExtensometer3D,...
|
||||||
|
Err3DExtensometerLink,ErrNTC3DExtensometerLink] = ...
|
||||||
|
defDati3DEL(Dati3DExtensometerLink,Dati3DExtensometerLink_Rif,...
|
||||||
|
DatiNTC3DExtensometerLink,Err3DExtensometerLink,ErrNTC3DExtensometerLink,...
|
||||||
|
Nodo3DExtensometerLink,r3DEL,Ch3DEL,EL3D_NTC,Ndatidespike,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[DatiExtensometer3D,DatiExtensometer3D_Rif,DatiNTCExtensometer3D,...
|
||||||
|
Err3DExtensometerLink] = conv_grezzi3DEL(Extensometer3D,NTCExtensometer3D,...
|
||||||
|
Extensometer3D_Rif,DCalEL3DTot,Nodo3DExtensometerLink,Err3DExtensometerLink,...
|
||||||
|
r3DEL,EL3D_NTC,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_3DEL,DatiExtensometer3D] = MediaDati_3DEL(DatiExtensometer3D,Time3DEL,...
|
||||||
|
NdatiMedia,FileName);
|
||||||
|
% Sottraggo la misura di riferimento
|
||||||
|
DatiExtensometer3D = DatiExtensometer3D - DatiExtensometer3D_Rif(1,:);
|
||||||
|
else
|
||||||
|
ARRAYdate_3DEL = [];
|
||||||
|
DatiExtensometer3D = [];
|
||||||
|
DatiNTCExtensometer3D = [];
|
||||||
|
text = 'There are not data to convert for 3D Extensometer Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear Dati3DExtensometerLink
|
||||||
|
clear DatiNTC3DExtensometerLink
|
||||||
|
clear Dati3DExtensometerLink_Rif
|
||||||
|
clear Time3DEL
|
||||||
|
clear Extensometer3D
|
||||||
|
clear NTCExtensometer3D
|
||||||
|
clear DCal3DELTot
|
||||||
|
clear DatiExtensometer3D_Rif
|
||||||
|
|
||||||
|
% --- Wire Extensometer Link ---
|
||||||
|
if yesWEL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeWEL,WireExtensometer,NTCWireExtensometer,ErrWireExtensometerLink]...
|
||||||
|
= defDatiWEL(DatiWireExtensometerLink,DatiNTCWireExtensometerLink,...
|
||||||
|
ErrWireExtensometerLink,ChWEL,WEL_NTC,rWEL,Ndatidespike,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[DatiWireExtensometer,DatiNTCWireExtensometer,ErrWireExtensometerLink] = conv_grezziWEL(...
|
||||||
|
WireExtensometer,NTCWireExtensometer,DCalWELTot,NodoWireExtensometerLink,...
|
||||||
|
ErrWireExtensometerLink,WEL_NTC,rWEL,Tmax,Tmin,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_WEL,DatiWireExtensometer] = MediaDati_WEL(DatiWireExtensometer,...
|
||||||
|
TimeWEL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_WEL = [];
|
||||||
|
DatiWireExtensometer = [];
|
||||||
|
DatiNTCWireExtensometer = [];
|
||||||
|
text = 'There are not data to convert for Wire Extensometer Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiWireExtensometerLink
|
||||||
|
clear DatiNTCWireExtensometerLink
|
||||||
|
clear TimeWEL
|
||||||
|
clear WireExtensometer
|
||||||
|
clear NTCWireExtensometer
|
||||||
|
clear DCalWELTot
|
||||||
|
|
||||||
|
% --- MultiPoint Rod Extensometer ---
|
||||||
|
if yesMPBEL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeMPBEL,DatiMPBEL,~,ErrMultiPointExtensometer] = ...
|
||||||
|
defDatiMPBEL(DatiMultiPointExtensometer,DatiNTCMultiPointExtensometer,...
|
||||||
|
ErrMultiPointExtensometer,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
DatiMultiBase = conv_grezziMPBEL(DatiMPBEL,NumBasi,DCalMPBELTot,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_MPBEL,DatiMultiBase] = MediaDati_MPBEL(DatiMultiBase,TimeMPBEL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_MPBEL = [];
|
||||||
|
DatiMultiBase = [];
|
||||||
|
text = 'There are not data to convert for MultiPoint Borehole Rod Extensometer';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiMultiPointExtensometer
|
||||||
|
clear DatiNTCMultiPointExtensometer
|
||||||
|
clear TimeMPBEL
|
||||||
|
clear DCalMPBELTot
|
||||||
|
|
||||||
|
% --- Analog Link ---
|
||||||
|
if yesAL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeAL,ADCAnalog,ErrAnalogLink] = defDatiAL(DatiAnalogLink,ErrAnalogLink,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
DatiAnalog = conv_grezziAL(ADCAnalog,DCalALTot,NodoAnalogLink,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_AL,DatiAnalog] = MediaDati_AL(DatiAnalog,TimeAL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_AL = [];
|
||||||
|
DatiAnalog = [];
|
||||||
|
text = 'There are not data to convert for Analog Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiAnalogLink
|
||||||
|
clear ADCAnalog
|
||||||
|
clear TimeAL
|
||||||
|
clear DCalALTot
|
||||||
|
|
||||||
|
% --- Crack Link ---
|
||||||
|
if yesCrL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeCrL,Crack,NTCCrack,ErrCrackLink] = defDatiCrL(DatiCrackLink,...
|
||||||
|
DatiNTCCrackLink,ErrCrackLink,ChCrL,CrL_NTC,rCrL,Ndatidespike,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[DatiCrack,DatiNTCCrack,ErrCrackLink] = conv_grezziCrL(Crack,NTCCrack,DCalCrLTot,...
|
||||||
|
NodoCrackLink,ErrCrackLink,CrL_NTC,rCrL,NuovoZeroCrL,IDcentralina,DTcatena,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_CrL,DatiCrack] = MediaDati_CrL(DatiCrack,TimeCrL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_CrL = [];
|
||||||
|
DatiCrack = [];
|
||||||
|
DatiNTCCrack = [];
|
||||||
|
text = 'There are not data to convert for Crack Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiCrackLink
|
||||||
|
clear TimeCrL
|
||||||
|
clear Crack
|
||||||
|
clear NTCCrack
|
||||||
|
clear DCalCrLTot
|
||||||
|
|
||||||
|
% --- 2D Crack Link ---
|
||||||
|
if yes2DCrL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[Time2DCrL,Crack2D,NTCCrack2D,Err2DCrackLink,ErrNTC2DCrackLink] = ...
|
||||||
|
defDati2DCrL(Dati2DCrackLink,DatiNTC2DCrackLink,Err2DCrackLink,ErrNTC2DCrackLink,...
|
||||||
|
r2DCrL,Nodo2DCrackLink,Ch2DCrL,CrL2D_NTC,Ndatidespike,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[Dati2DCrack,DatiNTCCrack2D,Err2DCrackLink] = conv_grezzi2DCrL(...
|
||||||
|
Crack2D,NTCCrack2D,DCal2DCrLTot,Nodo2DCrackLink,Err2DCrackLink,CrL2D_NTC,...
|
||||||
|
r2DCrL,NuovoZero2DCrL,IDcentralina,DTcatena,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_2DCrL,Dati2DCrack] = MediaDati_2DCrL(Dati2DCrack,Time2DCrL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_2DCrL = [];
|
||||||
|
Dati2DCrack = [];
|
||||||
|
DatiNTCCrack2D = [];
|
||||||
|
text = 'There are not data to convert for 2D Crack Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
clear Dati2DCrackLink
|
||||||
|
clear Time2DCrL
|
||||||
|
clear Crack2D
|
||||||
|
clear DCal2DCrLTot
|
||||||
|
clear DatiNTC2DCrackLink
|
||||||
|
|
||||||
|
% --- 3D Crack Link ---
|
||||||
|
if yes3DCrL == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[Time3DCrL,Crack3D,NTCCrack3D,Err3DCrackLink,ErrNTC3DCrackLink] = ...
|
||||||
|
defDati3DCrL(Dati3DCrackLink,DatiNTC3DCrackLink,Err3DCrackLink,ErrNTC3DCrackLink,...
|
||||||
|
r3DCrL,Nodo3DCrackLink,Ch3DCrL,CrL3D_NTC,Ndatidespike,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[Dati3DCrack,DatiNTCCrack3D,Err3DCrackLink] = conv_grezzi3DCrL(...
|
||||||
|
Crack3D,NTCCrack3D,DCal3DCrLTot,Nodo3DCrackLink,Err3DCrackLink,CrL3D_NTC,...
|
||||||
|
r3DCrL,NuovoZero3DCrL,IDcentralina,DTcatena,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_3DCrL,Dati3DCrack] = MediaDati_3DCrL(Dati3DCrack,Time3DCrL,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_3DCrL = [];
|
||||||
|
Dati3DCrack = [];
|
||||||
|
DatiNTCCrack3D = [];
|
||||||
|
text = 'There are not data to convert for 3D Crack Link';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
clear Dati3DCrackLink
|
||||||
|
clear Time3DCrL
|
||||||
|
clear Crack3D
|
||||||
|
clear DCal3DCrLTot
|
||||||
|
clear DatiNTC3DCrackLink
|
||||||
|
|
||||||
|
% --- Stress Meter ---
|
||||||
|
if yesSM == 1
|
||||||
|
% definizione dei dati
|
||||||
|
[TimeSM,Stress,NTCStress,ErrStressMeter] = defDatiSM(DatiStressMeter,...
|
||||||
|
DatiNTCStressMeter,ErrStressMeter,ChSM,SM_NTC,rSM,Ndatidespike,FileName);
|
||||||
|
% Conversione dei dati grezzi
|
||||||
|
[DatiStress,DatiNTCStress,ErrStressMeter] = conv_grezziSM(Stress,NTCStress,...
|
||||||
|
DatiStressMeter_Rif,DatiNTCStressMeter_Rif,DCalSMTot,NodoStressMeter,ErrStressMeter,...
|
||||||
|
SM_NTC,rSM,FileName);
|
||||||
|
% media mobile dei dati
|
||||||
|
[ARRAYdate_SM,DatiStress] = MediaDati_SM(DatiStress,TimeSM,NdatiMedia,FileName);
|
||||||
|
else
|
||||||
|
ARRAYdate_SM = [];
|
||||||
|
DatiStress = [];
|
||||||
|
DatiNTCStress = [];
|
||||||
|
text = 'There are not data to convert for Stress Meter';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
clear text
|
||||||
|
end
|
||||||
|
% Pulisco le variabili non più utilizzate
|
||||||
|
clear DatiStressMeter
|
||||||
|
clear DatiNTCStressMeter
|
||||||
|
clear TimeSM
|
||||||
|
clear Stress
|
||||||
|
clear NTCStress
|
||||||
|
clear DCalSMTot
|
||||||
|
|
||||||
|
%% Parte di Elaborazione
|
||||||
|
|
||||||
|
% --- Analisi Tunnel Link ---
|
||||||
|
if yesTuL == 1
|
||||||
|
margine = 1; % margine di n gg prima
|
||||||
|
[X_TuL,Xstar_TuL,Y_TuL,Z_TuL,Zstar_TuL,Xlocal_TuL,Ylocal_TuL,Zlocal_TuL,...
|
||||||
|
SegStar,HShift_local_TuL,TempDef_TuL,ARRAYdate_TuL,Area_TuL,Speed_local_TuL,...
|
||||||
|
Acceleration_local_TuL,ErrTunnelLink] = elab2D_TuL(rTuL,accTuL,ay_TuL,ay_TuL_AC,...
|
||||||
|
ACCdefRis_TuL,SpeTuL,IDcentralina,DTcatena,DatiElabTunnelLink,NuovoZeroTuL,...
|
||||||
|
TempDef_TuL,tolleranzaAcc,Ndevst,Wdevst,NdatiMedia,Ndatidespike,ARRAYdate_TuL,...
|
||||||
|
data1_AC,Nodo_AC,margine,ErrTunnelLink,Tmax,Tmin,datainiTuL,FileName);
|
||||||
|
xlswrite('Dati.xlsx',Xlocal_TuL',9);
|
||||||
|
xlswrite('Dati.xlsx',Ylocal_TuL',10);
|
||||||
|
xlswrite('Dati.xlsx',Zlocal_TuL',11);
|
||||||
|
xlswrite('Dati.xlsx',X_TuL',12);
|
||||||
|
xlswrite('Dati.xlsx',Y_TuL',13);
|
||||||
|
xlswrite('Dati.xlsx',Z_TuL',14);
|
||||||
|
xlswrite('Dati.xlsx',SegStar',15);
|
||||||
|
xlswrite('Dati.xlsx',HShift_local_TuL',16);
|
||||||
|
xlswrite('Dati.xlsx',TempDef_TuL,17);
|
||||||
|
xlswrite('Dati.xlsx',ARRAYdate_TuL,18);
|
||||||
|
xlswrite('Dati.xlsx',Area_TuL',19);
|
||||||
|
xlswrite('Dati.xlsx',Speed_local_TuL',20);
|
||||||
|
xlswrite('Dati.xlsx',Acceleration_local_TuL',21);
|
||||||
|
xlswrite('Dati.xlsx',ErrTunnelLink',22);
|
||||||
|
else
|
||||||
|
[X_TuL,Xstar_TuL,Y_TuL,Z_TuL,Zstar_TuL,Xlocal_TuL,Ylocal_TuL,Zlocal_TuL,...
|
||||||
|
SegStar,HShift_local_TuL,TempDef_TuL,Area_TuL,Speed_local_TuL,...
|
||||||
|
Acceleration_local_TuL] = matrici_vuote_TuL(FileName);
|
||||||
|
end
|
||||||
|
clear DatiElabTunnelLink
|
||||||
|
clear rTuL
|
||||||
|
clear accTuL
|
||||||
|
clear ay_TuL
|
||||||
|
clear ay_TuL_AC
|
||||||
|
clear data1_AC
|
||||||
|
clear ACCdefRis_TuL
|
||||||
|
clear SpeTuL
|
||||||
|
clear DatiElabTunnelLink
|
||||||
|
clear NuovoZeroTuL
|
||||||
|
clear Nodo_AC
|
||||||
|
clear data1_AC
|
||||||
|
% fine elaborazione Tunnel Link
|
||||||
|
|
||||||
|
% --- Analisi Radial Link ---
|
||||||
|
if yesRL == 1
|
||||||
|
[X_RL,Y_RL,Z_RL,Xlocal_RL,Ylocal_RL,Zlocal_RL,TempDef_RL,ARRAYdate_RL,...
|
||||||
|
ErrRadialLink] = elab2D_RL(rRL,accRL,ACCdefRis_RL,SpeRL,IDcentralina,DTcatena,...
|
||||||
|
DatiElabRadialLink,NuovoZeroRL,tolleranzaAcc,TempDef_RL,Ndevst,Wdevst,ARRAYdate_RL,...
|
||||||
|
elab_option,NdatiMedia,Ndatidespike,margine,ErrRadialLink,Tmax,Tmin,datainiRL,FileName);
|
||||||
|
xlswrite('Dati.xlsx',Xlocal_RL',9);
|
||||||
|
xlswrite('Dati.xlsx',Ylocal_RL',10);
|
||||||
|
xlswrite('Dati.xlsx',Zlocal_RL',11);
|
||||||
|
xlswrite('Dati.xlsx',X_RL',12);
|
||||||
|
xlswrite('Dati.xlsx',Y_RL',13);
|
||||||
|
xlswrite('Dati.xlsx',Z_RL',14);
|
||||||
|
xlswrite('Dati.xlsx',ARRAYdate_RL,15);
|
||||||
|
xlswrite('Dati.xlsx',ErrRadialLink',16);
|
||||||
|
else
|
||||||
|
[X_RL,Y_RL,Z_RL,Xlocal_RL,Ylocal_RL,Zlocal_RL,TempDef_RL] = matrici_vuote_RL(FileName);
|
||||||
|
end
|
||||||
|
clear DatiElabRadialLink
|
||||||
|
clear accRL
|
||||||
|
clear SpeRL
|
||||||
|
clear ACCdefRis_RL
|
||||||
|
clear NuovoZeroRL
|
||||||
|
clear rRL
|
||||||
|
% fine elaborazione Radial Link
|
||||||
|
|
||||||
|
% --- Tilt Link H ---
|
||||||
|
if yesTLH == 1
|
||||||
|
if strcmp(IDcentralina,'ID0142') == 1 && strcmp(DTcatena,'DT0173')
|
||||||
|
[Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,AlfaX_TLH,AlfaY_TLH,TempDef_TLH,...
|
||||||
|
speed_TLH,speed_local_TLH,acceleration_TLH,acceleration_local_TLH,ARRAYdate_TLH,...
|
||||||
|
ErrTiltLinkH] = elab2D_TLH_Hybrid(IDcentralina,DTcatena,rTLH,accTLH,ACCdefRis_TLH,...
|
||||||
|
TempDef_TLH,SpeTLH,PsTLH,tolleranzaAcc,DatiElabTiltLinkH,Ndevst,Wdevst,...
|
||||||
|
ARRAYdate_TLH,NuovoZeroTLH,NdatiMedia,Ndatidespike,ErrTiltLinkH,margine,...
|
||||||
|
Tmax,Tmin,datainiTLH,FileName);
|
||||||
|
else
|
||||||
|
[Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,AlfaX_TLH,AlfaY_TLH,TempDef_TLH,...
|
||||||
|
speed_TLH,speed_local_TLH,acceleration_TLH,acceleration_local_TLH,ARRAYdate_TLH,...
|
||||||
|
ErrTiltLinkH] = elab2D_TLH(IDcentralina,DTcatena,rTLH,accTLH,ACCdefRis_TLH,...
|
||||||
|
TempDef_TLH,SpeTLH,PsTLH,tolleranzaAcc,DatiElabTiltLinkH,Ndevst,Wdevst,...
|
||||||
|
ARRAYdate_TLH,NuovoZeroTLH,NdatiMedia,Ndatidespike,ErrTiltLinkH,margine,...
|
||||||
|
elab_option,Tmax,Tmin,datainiTLH,FileName);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
[Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,AlfaX_TLH,AlfaY_TLH,TempDef_TLH,...
|
||||||
|
speed_TLH,speed_local_TLH,acceleration_TLH,acceleration_local_TLH] = matrici_vuote_TLH(FileName);
|
||||||
|
end
|
||||||
|
clear DatiElabTiltLinkH
|
||||||
|
clear accTLH
|
||||||
|
clear ACCdefRis_TLH
|
||||||
|
clear SpeTLH
|
||||||
|
clear PsTLH
|
||||||
|
clear NuovoZeroTLH
|
||||||
|
% fine elaborazione Tilt Link H
|
||||||
|
|
||||||
|
% --- Tilt Link HR H ---
|
||||||
|
if yesTLHRH == 1
|
||||||
|
[Y_TLHRH,Z_TLHRH,Ylocal_TLHRH,Zlocal_TLHRH,AlfaX_TLHRH,AlfaY_TLHRH,...
|
||||||
|
TempDef_TLHRH,speed_TLHRH,speed_local_TLHRH,acceleration_TLHRH,acceleration_local_TLHRH,...
|
||||||
|
ARRAYdate_TLHRH,ErrTiltLinkHRH] = elab2D_TLHRH(rTLHRH,AngDef_TLHRH,TempDef_TLHRH,...
|
||||||
|
SpeTLHRH,PsTLHRH,DatiElabTiltLinkHRH,Ndevst_HR,Wdevst_HR,ARRAYdate_TLHRH,...
|
||||||
|
NuovoZeroTLHRH,NdatiMedia,Ndatidespike,ErrTiltLinkHRH,margine,elab_option,...
|
||||||
|
Tmax,Tmin,datainiTLHRH,FileName);
|
||||||
|
else
|
||||||
|
[Y_TLHRH,Z_TLHRH,Ylocal_TLHRH,Zlocal_TLHRH,AlfaX_TLHRH,AlfaY_TLHRH,TempDef_TLHRH,...
|
||||||
|
speed_TLHRH,speed_local_TLHRH,acceleration_TLHRH,acceleration_local_TLHRH] = matrici_vuote_TLHRH(FileName);
|
||||||
|
end
|
||||||
|
clear calotta_base
|
||||||
|
clear DatiElabTiltLinkHRH
|
||||||
|
clear AngDef_TLHRH
|
||||||
|
clear SpeTLHRH
|
||||||
|
clear PsTLHRH
|
||||||
|
clear NuovoZeroTLHRH
|
||||||
|
% fine elaborazione Tilt Link HR H
|
||||||
|
|
||||||
|
% --- PreConv Link ---
|
||||||
|
if yesPCL == 1
|
||||||
|
[Y_PCL,Z_PCL,Ylocal_PCL,Zlocal_PCL,AlfaX_PCL,AlfaY_PCL,TempDef_PCL,...
|
||||||
|
speed_PCL,speed_local_PCL,acceleration_PCL,acceleration_local_PCL,ARRAYdate_PCL,...
|
||||||
|
ErrPreConvLink] = elab2D_PCL(IDcentralina,DTcatena,rPCL,accPCL,ACCdefRis_PCL,...
|
||||||
|
TempDef_PCL,SpePCL,tolleranzaAcc,DatiElabPreConvLink,Ndevst,Wdevst,ARRAYdate_PCL,...
|
||||||
|
NuovoZeroPCL,NdatiMedia,Ndatidespike,ErrPreConvLink,margine,elab_option,...
|
||||||
|
Tmax,Tmin,datainiPCL,FileName);
|
||||||
|
else
|
||||||
|
[Y_PCL,Z_PCL,Ylocal_PCL,Zlocal_PCL,AlfaX_PCL,AlfaY_PCL,TempDef_PCL,...
|
||||||
|
speed_PCL,speed_local_PCL,acceleration_PCL,acceleration_local_PCL] = matrici_vuote_PCL(FileName);
|
||||||
|
end
|
||||||
|
clear DatiElabPreConvLink
|
||||||
|
clear accPCL
|
||||||
|
clear ACCdefRis_PCL
|
||||||
|
clear SpePCL
|
||||||
|
clear tolleranzaAcc
|
||||||
|
clear DatiElabPreConvLink
|
||||||
|
clear NuovoZeroPCL
|
||||||
|
clear rPCL
|
||||||
|
clear Ndevst
|
||||||
|
clear Wdevst
|
||||||
|
% fine elaborazione PreConv Link
|
||||||
|
|
||||||
|
% --- PreConv Link HR ---
|
||||||
|
if yesPCLHR == 1
|
||||||
|
[Y_PCLHR,Z_PCLHR,Ylocal_PCLHR,Zlocal_PCLHR,AlfaX_PCLHR,AlfaY_PCLHR,TempDef_PCLHR,...
|
||||||
|
speed_PCLHR,speed_local_PCLHR,acceleration_PCLHR,acceleration_local_PCLHR,ARRAYdate_PCLHR,...
|
||||||
|
ErrPreConvLinkHR] = elab2D_PCLHR(IDcentralina,DTcatena,rPCLHR,AngDef_PCLHR,...
|
||||||
|
TempDef_PCLHR,SpePCLHR,DatiElabPreConvLinkHR,Ndevst_HR,Wdevst_HR,ARRAYdate_PCLHR,...
|
||||||
|
NuovoZeroPCLHR,NdatiMedia,Ndatidespike,ErrPreConvLinkHR,margine,elab_option,Tmax,Tmin,...
|
||||||
|
datainiPCLHR,FileName);
|
||||||
|
else
|
||||||
|
[Y_PCLHR,Z_PCLHR,Ylocal_PCLHR,Zlocal_PCLHR,AlfaX_PCLHR,AlfaY_PCLHR,TempDef_PCLHR,...
|
||||||
|
speed_PCLHR,speed_local_PCLHR,acceleration_PCLHR,acceleration_local_PCLHR] = matrici_vuote_PCLHR(FileName);
|
||||||
|
end
|
||||||
|
clear DatiElabPreConvLinkHR
|
||||||
|
clear rPCLHR
|
||||||
|
clear AngDef_PCLHR
|
||||||
|
clear SpePCLHR
|
||||||
|
clear elab_option
|
||||||
|
clear Ndevst_HR
|
||||||
|
clear Wdevst_HR
|
||||||
|
clear NuovoZeroPCLHR
|
||||||
|
clear NdatiMedia
|
||||||
|
clear Ndatidespike
|
||||||
|
clear tolleranzaT
|
||||||
|
clear margine
|
||||||
|
clear elab_option
|
||||||
|
|
||||||
|
% --- 3D Extensometer Link ---
|
||||||
|
% Correzione 3D Extensometer Link
|
||||||
|
if yes3DEL == 1
|
||||||
|
[r,~] = size(Err3DExtensometerLink);
|
||||||
|
Matrice_err = zeros(r,r3DEL);
|
||||||
|
for i = 1:r % date
|
||||||
|
d = 1;
|
||||||
|
for n = 1:r3DEL % nodi
|
||||||
|
j = 1;
|
||||||
|
err = Err3DExtensometerLink(i,d:d+2);
|
||||||
|
while j <= 3
|
||||||
|
if err(1,j) == 1
|
||||||
|
Matrice_err(i,n) = 1;
|
||||||
|
end
|
||||||
|
j = j+1;
|
||||||
|
end
|
||||||
|
d = d+3;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Err3DExtensometerLink = Matrice_err;
|
||||||
|
Join = find(ErrNTC3DExtensometerLink);
|
||||||
|
[rJ,cJ] = size(Join);
|
||||||
|
for ii = 1:rJ
|
||||||
|
for jj = 1:cJ
|
||||||
|
if Err3DExtensometerLink(Join(ii,jj)) == 0
|
||||||
|
Err3DExtensometerLink(Join(ii,jj)) = 0.5;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
clear ErrNTC3DExtensometerLink
|
||||||
|
|
||||||
|
% --- Crack Link ---
|
||||||
|
if yesCrL == 1
|
||||||
|
NomeFile = ['' IDcentralina '-' DTcatena '-RifCrL.csv'];
|
||||||
|
if NuovoZeroCrL == 0 % prima elaborazione
|
||||||
|
csvwrite(NomeFile,DatiCrack(1,:));
|
||||||
|
DatiCrack = DatiCrack - DatiCrack(1,:);
|
||||||
|
else % Ci sono già dei dati elaborati
|
||||||
|
RIF = csvread(NomeFile);
|
||||||
|
DatiCrack = DatiCrack - RIF;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% --- 3D Crack Link ---
|
||||||
|
if yes3DCrL == 1
|
||||||
|
[r,~] = size(Err3DCrackLink);
|
||||||
|
Matrice_err = zeros(r,r3DCrL);
|
||||||
|
for i = 1:r % date
|
||||||
|
d = 1;
|
||||||
|
for n = 1:r3DCrL % nodi
|
||||||
|
j = 1;
|
||||||
|
err = Err3DCrackLink(i,d:d+2);
|
||||||
|
while j <= 3
|
||||||
|
if err(1,j) == 1
|
||||||
|
Matrice_err(i,n) = 1;
|
||||||
|
end
|
||||||
|
j = j+1;
|
||||||
|
end
|
||||||
|
d = d+3;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Err3DCrackLink = Matrice_err;
|
||||||
|
Join = find(ErrNTC3DCrackLink);
|
||||||
|
[rJ,cJ] = size(Join);
|
||||||
|
for ii = 1:rJ
|
||||||
|
for jj = 1:cJ
|
||||||
|
if Err3DCrackLink(Join(ii,jj)) == 0
|
||||||
|
Err3DCrackLink(Join(ii,jj)) = 0.5;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
clear ErrNTC3DCrackLink
|
||||||
|
|
||||||
|
% --- 2D Crack Link ---
|
||||||
|
if yes2DCrL == 1
|
||||||
|
[r,~] = size(Err2DCrackLink);
|
||||||
|
Matrice_err = zeros(r,r2DCrL);
|
||||||
|
for i = 1:r % date
|
||||||
|
d = 1;
|
||||||
|
for n = 1:r2DCrL % nodi
|
||||||
|
j = 1;
|
||||||
|
err = Err2DCrackLink(i,d:d+1);
|
||||||
|
while j <= 2
|
||||||
|
if err(1,j) == 1
|
||||||
|
Matrice_err(i,n) = 1;
|
||||||
|
end
|
||||||
|
j = j+1;
|
||||||
|
end
|
||||||
|
d = d+2;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Err2DCrackLink = Matrice_err;
|
||||||
|
Join = find(ErrNTC2DCrackLink);
|
||||||
|
[rJ,cJ] = size(Join);
|
||||||
|
for ii = 1:rJ
|
||||||
|
for jj = 1:cJ
|
||||||
|
if Err2DCrackLink(Join(ii,jj)) == 0
|
||||||
|
Err2DCrackLink(Join(ii,jj)) = 0.5;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
clear ErrNTC2DCrackLink
|
||||||
|
|
||||||
|
% --- MultiPoint Borehole Extensometer Link ---
|
||||||
|
% Correzione MultiPoint Extensometer
|
||||||
|
if yesMPBEL == 1
|
||||||
|
[r,~] = size(ErrMultiPointExtensometer);
|
||||||
|
Matrice_err = zeros(r,rMPBEL);
|
||||||
|
for i = 1:r % date
|
||||||
|
d = 1;
|
||||||
|
for n = 1:rMPBEL % nodi
|
||||||
|
j = 1;
|
||||||
|
err = ErrMultiPointExtensometer(i,d:d+NumBasi-1);
|
||||||
|
while j <= NumBasi
|
||||||
|
if err(1,j) == 1
|
||||||
|
Matrice_err(i,n) = 1;
|
||||||
|
end
|
||||||
|
j = j+1;
|
||||||
|
end
|
||||||
|
d = d+NumBasi;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ErrMultiPointExtensometer = Matrice_err;
|
||||||
|
Join = find(ErrNTCMultiPointExtensometer);
|
||||||
|
[rJ,cJ] = size(Join);
|
||||||
|
for ii = 1:rJ
|
||||||
|
for jj = 1:cJ
|
||||||
|
if ErrMultiPointExtensometer(Join(ii,jj)) == 0
|
||||||
|
ErrMultiPointExtensometer(Join(ii,jj)) = 0.5;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
clear ErrNTCMultiPointExtensometer
|
||||||
|
|
||||||
|
toc
|
||||||
|
text = ['ATD calculation ended in ' num2str(toc) ' seconds.'];
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
RC = 0;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
109
ATD/CANCELLA.m
Executable file
109
ATD/CANCELLA.m
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
DTcatena = input('Digitare il nome della catena: ','s');
|
||||||
|
|
||||||
|
dbname = 'ase_lar';
|
||||||
|
username = 'matlab';
|
||||||
|
password = 'Ase@2014';
|
||||||
|
driver = 'com.mysql.jdbc.Driver';
|
||||||
|
dburl = ['jdbc:mysql://160.78.21.55:3306/' dbname];
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'ToolNameID','NodeNum','EventDate','EventTime','XShift','YShift'};
|
||||||
|
% javaclasspath('C:\Program Files\MATLAB\R2008a\java\mysql-connector-java-3.1.14-bin.jar');
|
||||||
|
conn = database(dbname, username, password, driver, dburl);
|
||||||
|
|
||||||
|
comando = ['delete from ELABDATADISP where ToolNameID = ''' DTcatena ''''];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
close(conn)
|
||||||
|
|
||||||
|
%% Da una data
|
||||||
|
dbname = 'ase_lar';
|
||||||
|
username = 'matlab';
|
||||||
|
password = 'Ase@2014';
|
||||||
|
driver = 'com.mysql.jdbc.Driver';
|
||||||
|
dburl = ['jdbc:mysql://160.78.30.106:3306/' dbname];
|
||||||
|
|
||||||
|
conn = database(dbname, username, password, driver, dburl);
|
||||||
|
|
||||||
|
IDcentralina = 'ID0079';
|
||||||
|
DTcatena = 'DT0120';
|
||||||
|
date = '2021-10-07';
|
||||||
|
comando = ['delete from ELABDATADISP where UnitName = ''' IDcentralina ...
|
||||||
|
''' and ToolNameID = ''' DTcatena ''' and EventDate >= ''' date ''' '];
|
||||||
|
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
close(conn)
|
||||||
|
disp('Fatto')
|
||||||
|
|
||||||
|
%% 1
|
||||||
|
dbname = 'ase_lar';
|
||||||
|
username = 'matlab';
|
||||||
|
password = 'Ase@2014';
|
||||||
|
driver = 'com.mysql.jdbc.Driver';
|
||||||
|
dburl = ['jdbc:mysql://160.78.30.106:3306/' dbname];
|
||||||
|
|
||||||
|
conn = database(dbname, username, password, driver, dburl);
|
||||||
|
|
||||||
|
IDcentralina = 'ID0063';
|
||||||
|
DTcatena = 'DT0103';
|
||||||
|
date = '2021-10-18';
|
||||||
|
time = '00:00:01';
|
||||||
|
|
||||||
|
% comando = ['delete from ELABDATADISP where UnitName = ''' IDcentralina ...
|
||||||
|
% ''' and ToolNameID = ''' DTcatena ''' and EventDate = ''' date ''' and EventTime > ''' time ''' '];
|
||||||
|
|
||||||
|
comando = ['delete from ELABDATADISP where UnitName = ''' IDcentralina ...
|
||||||
|
''' and ToolNameID = ''' DTcatena ''' and EventDate >= ''' date ''' '];
|
||||||
|
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
close(conn)
|
||||||
|
|
||||||
|
disp('Fine!')
|
||||||
|
|
||||||
|
%% 2
|
||||||
|
dbname = 'ase_lar';
|
||||||
|
username = 'matlab';
|
||||||
|
password = 'Ase@2014';
|
||||||
|
driver = 'com.mysql.jdbc.Driver';
|
||||||
|
dburl = ['jdbc:mysql://160.78.30.106:3306/' dbname];
|
||||||
|
|
||||||
|
conn = database(dbname, username, password, driver, dburl);
|
||||||
|
|
||||||
|
DTcatena = 'DT0046';
|
||||||
|
IDcentralina = 'ID0150';
|
||||||
|
comando = ['delete from ELABDATADISP where ToolNameID = ''' DTcatena ''' and UnitName = ''' IDcentralina ''' '];
|
||||||
|
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
close(conn)
|
||||||
|
|
||||||
|
disp('Fine!')
|
||||||
|
|
||||||
|
%% 3
|
||||||
|
dbname = 'ase_lar';
|
||||||
|
username = 'matlab';
|
||||||
|
password = 'Ase@2014';
|
||||||
|
driver = 'com.mysql.jdbc.Driver';
|
||||||
|
dburl = ['jdbc:mysql://160.78.21.55:3306/' dbname];
|
||||||
|
|
||||||
|
conn = database(dbname, username, password, driver, dburl);
|
||||||
|
|
||||||
|
IDcentralina = 'ID0026';
|
||||||
|
DTcatena = 'DT0042';
|
||||||
|
date1 = '2019-02-20';
|
||||||
|
date2 = '2019-05-13';
|
||||||
|
comando = ['delete from ELABDATADISP where ToolNameID = ''' DTcatena ''' and Unitname = '''...
|
||||||
|
IDcentralina ''' and EventDate >= ''' date1 ''' and EventDate < ''' date2 ''' '];
|
||||||
|
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
close(conn)
|
||||||
|
|
||||||
|
disp('Fine!')
|
||||||
|
|
||||||
|
%% 4
|
||||||
|
INI = 1;
|
||||||
|
for i = INI:INI+6
|
||||||
|
DatiInPlaceLink(1,i) = cellstr(num2str(DatiRaw(end,i+1)));
|
||||||
|
end
|
||||||
|
|
||||||
|
INI = 1;
|
||||||
|
for i = INI:INI+5
|
||||||
|
DatiInPlaceLinkHR(1,i) = cellstr(num2str(DatiRaw(end,i+1)));
|
||||||
|
end
|
||||||
52
ATD/CalcoloBiax_PCL.m
Executable file
52
ATD/CalcoloBiax_PCL.m
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
function [Y_PCL,Z_PCL,asseY_PCL,asseZ_PCL,AlfaX_PCL,AlfaY_PCL] = CalcoloBiax_PCL(SpePCL,...
|
||||||
|
ii,jj,ax,ay,asseY_PCL,asseZ_PCL,Y_PCL,Z_PCL,...
|
||||||
|
AlfaX_PCL,AlfaY_PCL,elab_option,rPCL,IDcentralina,DTcatena)
|
||||||
|
|
||||||
|
if elab_option == 1 % Punto fisso a fondo foro
|
||||||
|
% calcolo il coseno dell'angolo di inclinazione
|
||||||
|
cosBeta = (1 - ax(ii,jj).^2).^0.5;
|
||||||
|
Yi = -1*SpePCL(ii)*cosBeta; % -1 per adattare il segno di CosBeta. le progressive sono da fare a ritroso
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
Zi = SpePCL(ii)*ax(ii,jj); % -1 per adattare il segno
|
||||||
|
% Rollio
|
||||||
|
AlfaX_PCL(ii,jj) = asind(ay(ii,jj));
|
||||||
|
% Inclinazione
|
||||||
|
AlfaY_PCL(ii,jj) = -1*asind(ax(ii,jj));
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseY_PCL(ii,jj) = Yi;
|
||||||
|
asseZ_PCL(ii,jj) = Zi;
|
||||||
|
if ii==1
|
||||||
|
Y_PCL (ii,jj) = Yi;
|
||||||
|
Z_PCL (ii,jj) = asseZ_PCL(ii,jj);
|
||||||
|
else
|
||||||
|
Y_PCL(ii,jj) = Y_PCL(ii-1,jj) + Yi;
|
||||||
|
Z_PCL(ii,jj) = Z_PCL(ii-1,jj) + asseZ_PCL(ii,jj);
|
||||||
|
end
|
||||||
|
elseif elab_option == -1 % Punto fisso nella sezione
|
||||||
|
% calcolo il coseno dell'angolo di inclinazione
|
||||||
|
cosBeta = (1 - ax(rPCL-ii+1,jj).^2).^0.5;
|
||||||
|
Yi = SpePCL(rPCL-ii+1)*cosBeta; %Le progressive sono da fare ad avanzamento
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
if strcmp(IDcentralina,'ID0068') && strcmp(DTcatena,'DT0106')
|
||||||
|
Zi = SpePCL(rPCL-ii+1)*ax(rPCL-ii+1,jj);
|
||||||
|
else
|
||||||
|
Zi = -1*SpePCL(rPCL-ii+1)*ax(rPCL-ii+1,jj);
|
||||||
|
end
|
||||||
|
% Rollio
|
||||||
|
AlfaX_PCL(rPCL-ii+1,jj) = asind(ay(rPCL-ii+1,jj));
|
||||||
|
% Inclinazione
|
||||||
|
AlfaY_PCL(rPCL-ii+1,jj) = -1*asind(ax(rPCL-ii+1,jj));
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseY_PCL(rPCL-ii+1,jj) = Yi;
|
||||||
|
asseZ_PCL(rPCL-ii+1,jj) = Zi;
|
||||||
|
|
||||||
|
if ii==1
|
||||||
|
Y_PCL (rPCL-ii+1,jj) = Yi;
|
||||||
|
Z_PCL (rPCL-ii+1,jj) = asseZ_PCL(rPCL-ii+1,jj);
|
||||||
|
else
|
||||||
|
Y_PCL(rPCL-ii+1,jj) = Y_PCL(rPCL-ii+2,jj) + Yi;
|
||||||
|
Z_PCL(rPCL-ii+1,jj) = Z_PCL(rPCL-ii+2,jj) + asseZ_PCL(rPCL-ii+1,jj);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
44
ATD/CalcoloBiax_PCLHR.m
Executable file
44
ATD/CalcoloBiax_PCLHR.m
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
function [Y_PCLHR,Z_PCLHR,asseY_PCLHR,asseZ_PCLHR,AlfaX_PCLHR,AlfaY_PCLHR] = ...
|
||||||
|
CalcoloBiax_PCLHR(SpePCLHR,ii,jj,ax,ay,asseY_PCLHR,asseZ_PCLHR,asseY_Rif_PCLHR,...
|
||||||
|
asseZ_Rif_PCLHR,Y_PCLHR,Z_PCLHR,AlfaX_PCLHR,AlfaY_PCLHR,elab_option,rPCLHR)
|
||||||
|
|
||||||
|
if elab_option == 1 % Punto fisso a fondo foro
|
||||||
|
% calcolo il coseno dell'angolo di inclinazione
|
||||||
|
Yi = -1*SpePCLHR(ii)*cos(ax(ii,jj)); % -1 per adattare il segno di CosBeta. le progressive sono da fare a ritroso
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
Zi = -1*SpePCLHR(ii)*sin(ax(ii,jj)); % -1 per adattare il segno
|
||||||
|
% Rollio
|
||||||
|
AlfaX_PCLHR(ii,jj) = ay(ii,jj)./0.01745329251994329576923690768489; % Ritorno in gradi
|
||||||
|
% Inclinazione
|
||||||
|
AlfaY_PCLHR(ii,jj) = ax(ii,jj)./0.01745329251994329576923690768489;
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseY_PCLHR(ii,jj) = -asseY_Rif_PCLHR(ii,1)+Yi;
|
||||||
|
asseZ_PCLHR(ii,jj) = -asseZ_Rif_PCLHR(ii,1)+Zi;
|
||||||
|
if ii==1
|
||||||
|
Y_PCLHR (ii,jj) = Yi;
|
||||||
|
Z_PCLHR (ii,jj) = asseZ_PCLHR(ii,jj);
|
||||||
|
else
|
||||||
|
Y_PCLHR(ii,jj) = Y_PCLHR(ii-1,jj) + Yi;
|
||||||
|
Z_PCLHR(ii,jj) = Z_PCLHR(ii-1,jj) + asseZ_PCLHR(ii,jj);
|
||||||
|
end
|
||||||
|
elseif elab_option == -1 % Punto fisso nella sezione
|
||||||
|
Yi = SpePCLHR(rPCLHR-ii+1)*cos(ax(ii,jj)); % -1 per adattare il segno di CosBeta. le progressive sono da fare a ritroso
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
Zi = SpePCLHR(rPCLHR-ii+1)*sin(ax(ii,jj));
|
||||||
|
% Rollio
|
||||||
|
AlfaX_PCLHR(ii,jj) = ay(ii,jj)./0.01745329251994329576923690768489; % Ritorno in gradi
|
||||||
|
% Inclinazione
|
||||||
|
AlfaY_PCLHR(ii,jj) = ax(ii,jj)./0.01745329251994329576923690768489;
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseY_PCLHR(rPCLHR-ii+1,jj) = asseY_Rif_PCLHR(rPCLHR-ii+1,1)+Yi;
|
||||||
|
asseZ_PCLHR(rPCLHR-ii+1,jj) = asseZ_Rif_PCLHR(ii,1)+Zi;
|
||||||
|
if ii==1
|
||||||
|
Y_PCLHR (rPCLHR-ii+1,jj) = Yi;
|
||||||
|
Z_PCLHR (rPCLHR-ii+1,jj) = asseZ_PCLHR(rPCLHR-ii+1,jj);
|
||||||
|
else
|
||||||
|
Y_PCLHR(rPCLHR-ii+1,jj) = Y_PCLHR(rPCLHR-ii+2,jj) + Yi;
|
||||||
|
Z_PCLHR(rPCLHR-ii+1,jj) = Z_PCLHR(rPCLHR-ii+2,jj) + asseZ_PCLHR(rPCLHR-ii+1,jj);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
49
ATD/CalcoloBiax_RL.m
Executable file
49
ATD/CalcoloBiax_RL.m
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
function [X_RL,Y_RL,Z_RL,asseX_RL,asseY_RL,asseZ_RL] = CalcoloBiax_RL(SpeRL,...
|
||||||
|
ii,jj,ax,ay,asseX_RL,asseY_RL,asseZ_RL,X_RL,Y_RL,Z_RL,elab_option)
|
||||||
|
|
||||||
|
%% RAD-Array parete di DESTRA
|
||||||
|
if elab_option == 1
|
||||||
|
% Spostamento lungo l'asse X registrato dal nodo i
|
||||||
|
Xi = -1*SpeRL(ii,1) * ay(ii,jj); % -1 per adattare il verso (da destra verso sx!)
|
||||||
|
% calcolo il coseno dell'angolo di inclinazione
|
||||||
|
cosBetaX = (1 - ay(ii,jj).^2).^0.5;
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
Zi = -1*SpeRL(ii)*cosBetaX; % -1 per adattare il segno di CosBeta. Az infatti sarebbe negativo
|
||||||
|
% Spostamento lungo l'asse Y registrato dal nodo i
|
||||||
|
if jj==1
|
||||||
|
Yi = -1 * Zi * ax(ii,jj);
|
||||||
|
else
|
||||||
|
Yi = -1 * asseZ_RL(ii,jj-1) * ax(ii,jj);
|
||||||
|
end
|
||||||
|
%% RAD-Array parete di SINISTRA
|
||||||
|
elseif elab_option == -1
|
||||||
|
% Spostamento lungo l'asse X registrato dal nodo i
|
||||||
|
Xi = SpeRL(ii,1) * ay(ii,jj);
|
||||||
|
% calcolo il coseno dell'angolo di inclinazione
|
||||||
|
cosBetaX = (1 - ay(ii,jj).^2).^0.5;
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
Zi = -1*SpeRL(ii)*cosBetaX; % -1 per adattare il segno di CosBeta. Az infatti sarebbe negativo
|
||||||
|
% Spostamento lungo l'asse Y registrato dal nodo i
|
||||||
|
if jj==1
|
||||||
|
Yi = Zi * ax(ii,jj);
|
||||||
|
else
|
||||||
|
Yi = asseZ_RL(ii,jj-1) * ax(ii,jj);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseX_RL(ii,jj) = Xi;
|
||||||
|
asseY_RL(ii,jj) = Yi;
|
||||||
|
asseZ_RL(ii,jj) = Zi;
|
||||||
|
|
||||||
|
if ii==1
|
||||||
|
X_RL(ii,jj) = asseX_RL(ii,jj);
|
||||||
|
Y_RL (ii,jj) = asseY_RL(ii,jj);
|
||||||
|
Z_RL (ii,jj) = asseZ_RL(ii,jj);
|
||||||
|
else
|
||||||
|
X_RL(ii,jj) = X_RL(ii-1,jj) + asseX_RL(ii,jj); % Matrici cumulate
|
||||||
|
Y_RL(ii,jj) = Y_RL(ii-1,jj) + asseY_RL(ii,jj);
|
||||||
|
Z_RL(ii,jj) = Z_RL(ii-1,jj) + asseZ_RL(ii,jj);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
31
ATD/CalcoloBiax_TLH.m
Executable file
31
ATD/CalcoloBiax_TLH.m
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
function [Y_TLH,Z_TLH,asseY_TLH,asseZ_TLH,AlfaX_TLH,AlfaY_TLH] = CalcoloBiax_TLH(...
|
||||||
|
SpeTLH,PsTLH,ii,jj,ax,ay,asseY_TLH,asseZ_TLH,Y_TLH,Z_TLH,...
|
||||||
|
elab_option,AlfaX_TLH,AlfaY_TLH)
|
||||||
|
|
||||||
|
% calcolo il coseno dell'angolo di inclinazione
|
||||||
|
cosBeta = (1 - ax(ii,jj).^2).^0.5;
|
||||||
|
Yi = -1*(SpeTLH(ii)-abs(SpeTLH(ii)*cosBeta));
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
if elab_option == -1 % Arco Rovescio
|
||||||
|
Zi = SpeTLH(ii)*ax(ii,jj);
|
||||||
|
elseif elab_option == 1 % Calotta
|
||||||
|
Zi = -1*SpeTLH(ii)*ax(ii,jj);
|
||||||
|
end
|
||||||
|
|
||||||
|
% Rollio
|
||||||
|
AlfaX_TLH(ii,jj) = asind(ay(ii,jj));
|
||||||
|
AlfaY_TLH(ii,jj) = asind(ax(ii,jj));
|
||||||
|
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseY_TLH(ii,jj) = Yi;
|
||||||
|
asseZ_TLH(ii,jj) = Zi;
|
||||||
|
|
||||||
|
if ii==1
|
||||||
|
Y_TLH (ii,jj) = PsTLH(ii,1) + asseY_TLH(ii,jj);
|
||||||
|
Z_TLH (ii,jj) = asseZ_TLH(ii,jj);
|
||||||
|
else
|
||||||
|
Y_TLH(ii,jj) = PsTLH(ii,1) + asseY_TLH(ii,jj) + Y_TLH(ii-1,jj) - PsTLH(ii-1,1);
|
||||||
|
Z_TLH(ii,jj) = Z_TLH(ii-1,jj) + asseZ_TLH(ii,jj);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
31
ATD/CalcoloBiax_TLHRH.m
Executable file
31
ATD/CalcoloBiax_TLHRH.m
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
function [Y_TLHRH,Z_TLHRH,asseY_TLHRH,asseZ_TLHRH,AlfaX_TLHRH,AlfaY_TLHRH] = CalcoloBiax_TLHRH(...
|
||||||
|
SpeTLHRH,PsTLHRH,ii,jj,ax,ay,asseY_TLHRH,asseZ_TLHRH,Y_TLHRH,Z_TLHRH,...
|
||||||
|
calotta_base,AlfaX_TLHRH,AlfaY_TLHRH)
|
||||||
|
|
||||||
|
% calcolo il coseno dell'angolo di inclinazione
|
||||||
|
Yi = -1*(SpeTLHRH(ii,1) - SpeTLHRH(ii,1) * cos(ax(ii,jj))); % SP*cos(alfa)
|
||||||
|
% Spostamento lungo l'asse Z registrato dal nodo i
|
||||||
|
if calotta_base == -1 % Arco Rovescio
|
||||||
|
Zi = SpeTLHRH(ii,1) * sin(ax(ii,jj)); % SP*sin(alfa)
|
||||||
|
elseif calotta_base == 1 % Calotta
|
||||||
|
Zi = -1*SpeTLHRH(ii)*sin(ax(ii,jj));
|
||||||
|
end
|
||||||
|
|
||||||
|
% Rollio
|
||||||
|
AlfaX_TLHRH(ii,jj) = ay(ii,jj)/0.01745329251994329576923690768489; % Torno in gradi
|
||||||
|
% Inclinazione
|
||||||
|
AlfaY_TLHRH(ii,jj) = ax(ii,jj)/0.01745329251994329576923690768489;
|
||||||
|
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseY_TLHRH(ii,jj) = Yi;
|
||||||
|
asseZ_TLHRH(ii,jj) = Zi;
|
||||||
|
|
||||||
|
if ii==1
|
||||||
|
Y_TLHRH (ii,jj) = PsTLHRH(ii) + asseY_TLHRH(ii,jj);
|
||||||
|
Z_TLHRH (ii,jj) = asseZ_TLHRH(ii,jj);
|
||||||
|
else
|
||||||
|
Y_TLHRH(ii,jj) = PsTLHRH(ii,1) + asseY_TLHRH(ii,jj) + Y_TLHRH(ii-1,jj) - PsTLHRH(ii-1,1);
|
||||||
|
Z_TLHRH(ii,jj) = Z_TLHRH(ii-1,jj) + asseZ_TLHRH(ii,jj);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
56
ATD/CalcoloBiax_TuL.m
Executable file
56
ATD/CalcoloBiax_TuL.m
Executable file
@@ -0,0 +1,56 @@
|
|||||||
|
function [X_TuL,Y_TuL,Z_TuL,asseX_TuL,asseY_TuL,asseZ_TuL,Xstar_TuL,Ystar_TuL,...
|
||||||
|
Zstar_TuL,asseXstar_TuL,asseYstar_TuL,asseZstar_TuL] = CalcoloBiax_TuL(SpeTuL,...
|
||||||
|
ii,jj,ax,ay,az,asseX_TuL,asseY_TuL,asseZ_TuL,X_TuL,Y_TuL,Z_TuL,...
|
||||||
|
asseXstar_TuL,asseYstar_TuL,asseZstar_TuL,Xstar_TuL,Ystar_TuL,Zstar_TuL,...
|
||||||
|
Nnodi,PosIniEnd,indiceX,indiceZ,rTuL,FileName)
|
||||||
|
|
||||||
|
%% Calcolo Orario
|
||||||
|
% Spostamento lungo l'asse X registrato dal nodo i; uso -1 per adattarlo al sistema di riferimento scelto
|
||||||
|
Xi = SpeTuL(ii,1) * ay(ii,jj); % ay rappresenta il seno dell'angolo % giusto
|
||||||
|
Zi = -1 * SpeTuL(ii,1) *(ax(ii,jj)); % ax rappresenta il seno dell'angolo di quell'asse rispetto all'orizzontale
|
||||||
|
if jj==1
|
||||||
|
Yi = -1 * Zi * az(ii,jj);
|
||||||
|
else
|
||||||
|
Yi = -1 * asseZ_TuL(ii,jj-1) * az(ii,jj);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Calcolo antiorario (a partire dall'ultimo nodo!)
|
||||||
|
XiStar = -1*SpeTuL(Nnodi+1-ii,1) * ay(Nnodi+1-ii,jj);
|
||||||
|
% XiStar = SpeTuL(Nnodi+1-ii,1) * ay(Nnodi+1-ii,jj); % da canc
|
||||||
|
ZiStar = SpeTuL(Nnodi+1-ii,1) * ax(Nnodi+1-ii,jj);
|
||||||
|
% ZiStar = -1*SpeTuL(Nnodi+1-ii,1) * ax(Nnodi+1-ii,jj); % da canc
|
||||||
|
if jj==1
|
||||||
|
YiStar = ZiStar * az(Nnodi+1-ii,jj);
|
||||||
|
else
|
||||||
|
YiStar = asseZstar_TuL(ii,jj-1) * az(Nnodi+1-ii,jj);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Correzione per nodi con segno sbagliato (montati male)
|
||||||
|
[Xi,Zi,Yi,XiStar,ZiStar,YiStar] = corrTuL(indiceX,indiceZ,Xi,Zi,Yi,...
|
||||||
|
XiStar,ZiStar,YiStar,ii,rTuL,FileName);
|
||||||
|
|
||||||
|
% Matrici singoli spostamenti
|
||||||
|
asseX_TuL(ii,jj) = Xi;
|
||||||
|
asseY_TuL(ii,jj) = Yi;
|
||||||
|
asseZ_TuL(ii,jj) = Zi;
|
||||||
|
asseXstar_TuL(ii,jj) = XiStar;
|
||||||
|
asseYstar_TuL(ii,jj) = YiStar;
|
||||||
|
asseZstar_TuL(ii,jj) = ZiStar;
|
||||||
|
|
||||||
|
if ii==1
|
||||||
|
X_TuL(ii,jj) = asseX_TuL(ii,jj) + PosIniEnd(1,1);
|
||||||
|
Y_TuL(ii,jj) = asseY_TuL(ii,jj) + PosIniEnd(1,2);
|
||||||
|
Z_TuL(ii,jj) = asseZ_TuL(ii,jj) + PosIniEnd(1,3);
|
||||||
|
Xstar_TuL(ii,jj) = PosIniEnd(2,1) + asseXstar_TuL(ii,jj);
|
||||||
|
Ystar_TuL(ii,jj) = PosIniEnd(2,2) + asseYstar_TuL(ii,jj);
|
||||||
|
Zstar_TuL(ii,jj) = PosIniEnd(2,3) + asseZstar_TuL(ii,jj);
|
||||||
|
else
|
||||||
|
X_TuL(ii,jj) = X_TuL(ii-1,jj) + asseX_TuL(ii,jj); % Matrici cumulate
|
||||||
|
Y_TuL(ii,jj) = Y_TuL(ii-1,jj) + asseY_TuL(ii,jj);
|
||||||
|
Z_TuL(ii,jj) = Z_TuL(ii-1,jj) + asseZ_TuL(ii,jj);
|
||||||
|
Xstar_TuL(ii,jj) = Xstar_TuL(ii-1,jj) + asseXstar_TuL(ii,jj); % Matrici cumulate antiorarie
|
||||||
|
Ystar_TuL(ii,jj) = Ystar_TuL(ii-1,jj) + asseYstar_TuL(ii,jj);
|
||||||
|
Zstar_TuL(ii,jj) = Zstar_TuL(ii-1,jj) + asseZstar_TuL(ii,jj);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
88
ATD/CalcoloStar.m
Executable file
88
ATD/CalcoloStar.m
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
%% Funzione che calcola i segmenti della stella
|
||||||
|
function SegStar = CalcoloStar(X_TuL,Z_TuL,Xstar_TuL,Zstar_TuL,Verso,Segmenti,Peso,jj,SegStar,Nnodi,dim)
|
||||||
|
|
||||||
|
for J = 1:dim
|
||||||
|
N1 = Segmenti(J,1); % Numero primo punto
|
||||||
|
N1b = Segmenti(J,2); % Numero primo punto b
|
||||||
|
C1 = isnan(Segmenti(J,2)); % cerco se la seconda colonna è un NaN
|
||||||
|
N2 = Segmenti(J,3); % Numero secondo punto
|
||||||
|
[~,chc] = size(Segmenti);
|
||||||
|
if chc == 3 % non c'è la quarta colonna
|
||||||
|
C2 = 1;
|
||||||
|
else
|
||||||
|
N2b = Segmenti(J,4); % Numero secondo punto b
|
||||||
|
C2 = isnan(Segmenti(J,4)); % cerco se la quarta colonna è un NaN
|
||||||
|
end
|
||||||
|
X1 = X_TuL;
|
||||||
|
Xstar1 = Xstar_TuL;
|
||||||
|
Z1 = Z_TuL;
|
||||||
|
Zstar1 = Zstar_TuL;
|
||||||
|
X2 = X_TuL;
|
||||||
|
Xstar2 = Xstar_TuL;
|
||||||
|
Z2 = Z_TuL;
|
||||||
|
Zstar2 = Zstar_TuL;
|
||||||
|
|
||||||
|
if C1 == 0 % uso la media fra due nodi per il punto di inizio
|
||||||
|
X1(N1,jj) = (X_TuL(N1,jj) + X_TuL(N1b,jj))/2;
|
||||||
|
Z1(N1,jj) = (Z_TuL(N1,jj) + Z_TuL(N1b,jj))/2;
|
||||||
|
Xstar1(Nnodi-N1,jj) = (Xstar_TuL(Nnodi-N1,jj) + Xstar_TuL(Nnodi-N1b,jj))/2;
|
||||||
|
Zstar1(Nnodi-N1,jj) = (Zstar_TuL(Nnodi-N1,jj) + Zstar_TuL(Nnodi-N1b,jj))/2;
|
||||||
|
end
|
||||||
|
if C2 == 0 % uso la media fra due nodi per il punto di arrivo
|
||||||
|
X2(N2,jj) = (X_TuL(N2,jj) + X_TuL(N2b,jj))/2;
|
||||||
|
Z2(N2,jj) = (Z_TuL(N2,jj) + Z_TuL(N2b,jj))/2;
|
||||||
|
Xstar2(Nnodi-N2,jj) = (Xstar_TuL(Nnodi-N2,jj) + Xstar_TuL(Nnodi-N2b,jj))/2;
|
||||||
|
Zstar2(Nnodi-N2,jj) = (Zstar_TuL(Nnodi-N2,jj) + Zstar_TuL(Nnodi-N2b,jj))/2;
|
||||||
|
end
|
||||||
|
|
||||||
|
if Verso(J,1) == 1 && Verso (J,2) == 1 % Calcolo Orario per entrambi i punti (standard)
|
||||||
|
if N1==0
|
||||||
|
SegStar(J,jj) = real(((0 - X2(N2,jj)).^2+(0-Z2(N2,jj)).^2).^0.5);
|
||||||
|
elseif N2==0
|
||||||
|
SegStar(J,jj) = real((((X1(N1,jj)- 0)).^2+(Z1(N1,jj)-0).^2).^0.5);
|
||||||
|
else
|
||||||
|
SegStar(J,jj) = real(((X1(N1,jj)- X2(N2,jj)).^2+(Z1(N1,jj)-Z2(N2,jj)).^2).^0.5);
|
||||||
|
end
|
||||||
|
elseif Verso(J,1) == 1 && Verso (J,2) == -1 % Calcolo Orario il primo, antiorario per il secondo punto
|
||||||
|
SegStar(J,jj) = real(((X1(N1,jj)-Xstar2(Nnodi-N2,jj)).^2+(Z1(N1,jj)-Zstar2(Nnodi-N2,jj)).^2).^0.5);
|
||||||
|
elseif Verso(J,1) == 1 && Verso (J,2) == 0 % Calcolo Orario il primo, media fra orario e antiorario per il secondo punto
|
||||||
|
Peso3 = Peso(J,3);
|
||||||
|
Peso4 = Peso(J,4);
|
||||||
|
Xmedium2 = (Peso3*X2(N2,jj) + Peso4*Xstar2(Nnodi-N2,jj))/(Peso3+Peso4);
|
||||||
|
Zmedium2 = (Peso3*Z2(N2,jj) + Peso4*Zstar2(Nnodi-N2,jj))/(Peso3+Peso4);
|
||||||
|
SegStar(J,jj) = real(((X1(N1,jj)-Xmedium2).^2+(Z1(N1,jj)-Zmedium2).^2).^0.5);
|
||||||
|
elseif Verso(J,1) == -1 && Verso (J,2) == -1 % Calcolo antiorario per entrambi
|
||||||
|
SegStar(J,jj) = real(((Xstar1(Nnodi-N1,jj)-Xstar2(Nnodi-N2,jj)).^2+(Zstar1(Nnodi-N1,jj)-Zstar2(Nnodi-N2,jj)).^2).^0.5);
|
||||||
|
elseif Verso(J,1) == -1 && Verso (J,2) == 1 % Calcolo antiorario per il primo, orario per il secondo
|
||||||
|
SegStar(J,jj) = real(((X2(N2,jj)-Xstar1(Nnodi-N1,jj)).^2+(Z2(N2,jj)-Zstar1(Nnodi-N1,jj)).^2).^0.5);
|
||||||
|
elseif Verso(J,1) == -1 && Verso (J,2) == 0 % Calcolo antiorario il primo, media fra orario e antiorario per il secondo punto
|
||||||
|
Peso3 = Peso(J,3);
|
||||||
|
Peso4 = Peso(J,4);
|
||||||
|
Xmedium2 = (Peso3*X2(N2,jj) + Peso4*Xstar2(Nnodi-N2,jj))/(Peso3+Peso4);
|
||||||
|
Zmedium2 = (Peso3*Z2(N2,jj) + Peso4*Zstar2(Nnodi-N2,jj))/(Peso3+Peso4);
|
||||||
|
SegStar(J,jj) = real(((Xstar1(Nnodi-N1,jj)-Xmedium2).^2+(Zstar1(Nnodi-N1,jj)-Zmedium2).^2).^0.5);
|
||||||
|
elseif Verso(J,1) == 0 && Verso (J,2) == 0 % Calcolo media fra orario e antiorario per entrambi
|
||||||
|
Peso1 = Peso(J,1);
|
||||||
|
Peso2 = Peso(J,2);
|
||||||
|
Peso3 = Peso(J,3);
|
||||||
|
Peso4 = Peso(J,4);
|
||||||
|
Xmedium1 = (Peso1*X1(N1,jj) + Peso2*Xstar1(Nnodi-N1,jj))/(Peso1+Peso2);
|
||||||
|
Xmedium2 = (Peso3*X2(N2,jj) + Peso4*Xstar2(Nnodi-N2,jj))/(Peso3+Peso4);
|
||||||
|
Zmedium1 = (Peso1*Z1(N1,jj) + Peso2*Zstar1(Nnodi-N1,jj))/(Peso1+Peso2);
|
||||||
|
Zmedium2 = (Peso3*Z2(N2,jj) + Peso4*Zstar2(Nnodi-N2,jj))/(Peso3+Peso4);
|
||||||
|
SegStar(J,jj) = real(((Xmedium1-Xmedium2).^2+(Zmedium1-Zmedium2).^2).^0.5);
|
||||||
|
elseif Verso(J,1) == 0 && Verso (J,2) == 1 % Calcolo media fra orario e antiorario per il primo, orario per il secondo
|
||||||
|
Peso1 = Peso(J,1);
|
||||||
|
Peso2 = Peso(J,2);
|
||||||
|
Xmedium1 = (Peso1*X1(N1,jj) + Peso2*Xstar1(Nnodi-N1,jj))/(Peso1+Peso2);
|
||||||
|
Zmedium1 = (Peso1*Z_TuL(N1,jj) + Peso2*Zstar_TuL(Nnodi-N1,jj))/(Peso1+Peso2);
|
||||||
|
SegStar(J,jj) = real(((X2(N2,jj)-Xmedium1).^2+(Z2(N1,jj)-Zmedium1).^2).^0.5);
|
||||||
|
elseif Verso(J,1) == 0 && Verso (J,2) == -1 % Calcolo media fra orario e antiorario per il primo, antiorario per il secondo
|
||||||
|
Peso1 = Peso(J,1);
|
||||||
|
Peso2 = Peso(J,2);
|
||||||
|
Xmedium1 = (Peso1*X1(N1,jj) + Peso2*Xstar1(Nnodi-N1,jj))/(Peso1+Peso2);
|
||||||
|
Zmedium1 = (Peso1*Z1(N1,jj) + Peso2*Zstar1(Nnodi-N1,jj))/(Peso1+Peso2);
|
||||||
|
SegStar(J,jj) = real(((Xstar2(Nnodi-N2,jj)-Xmedium1).^2+(Zstar2(Nnodi-N2,jj)-Zmedium1).^2).^0.5);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
42
ATD/CalcoloStar_Report.m
Executable file
42
ATD/CalcoloStar_Report.m
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
%% Funzione che calcola i segmenti della stella
|
||||||
|
function SegStar = CalcoloStar_Report(X_TuL,Z_TuL,Verso,Segmenti,SegStar,dim)
|
||||||
|
|
||||||
|
X1 = X_TuL(:,1);
|
||||||
|
Z1 = Z_TuL(:,1);
|
||||||
|
X2 = X_TuL(:,1);
|
||||||
|
Z2 = Z_TuL(:,1);
|
||||||
|
X1f = X_TuL(:,end);
|
||||||
|
Z1f = Z_TuL(:,end);
|
||||||
|
X2f = X_TuL(:,end);
|
||||||
|
Z2f = Z_TuL(:,end);
|
||||||
|
for J = 1:dim
|
||||||
|
N1 = Segmenti(J,1); % Numero primo punto
|
||||||
|
N1b = Segmenti(J,2); % Numero primo punto b
|
||||||
|
C1 = isnan(Segmenti(J,2)); % cerco se la seconda colonna è un NaN
|
||||||
|
N2 = Segmenti(J,3); % Numero secondo punto
|
||||||
|
[~,chc] = size(Segmenti);
|
||||||
|
if chc == 3 % non c'è la quarta colonna
|
||||||
|
C2 = 1;
|
||||||
|
else
|
||||||
|
N2b = Segmenti(J,4); % Numero secondo punto b
|
||||||
|
C2 = isnan(Segmenti(J,4)); % cerco se la quarta colonna è un NaN
|
||||||
|
end
|
||||||
|
if C1 == 0 % uso la media fra due nodi per il punto di inizio
|
||||||
|
X1(N1,1) = (X_TuL(N1,1) + X_TuL(N1b,1))/2;
|
||||||
|
X1f(N1,end) = (X_TuL(N1,end) + X_TuL(N1b,end))/2;
|
||||||
|
Z1(N1,1) = (Z_TuL(N1,1) + Z_TuL(N1b,1))/2;
|
||||||
|
Z1f(N1,end) = (Z_TuL(N1,end) + Z_TuL(N1b,end))/2;
|
||||||
|
end
|
||||||
|
if C2 == 0 % uso la media fra due nodi per il punto di arrivo
|
||||||
|
X2(N2,1) = (X_TuL(N2,1) + X_TuL(N2b,1))/2;
|
||||||
|
X2f(N2,end) = (X_TuL(N2,end) + X_TuL(N2b,end))/2;
|
||||||
|
Z2(N2,1) = (Z_TuL(N2,1) + Z_TuL(N2b,1))/2;
|
||||||
|
Z2f(N2,end) = (Z_TuL(N2,end) + Z_TuL(N2b,end))/2;
|
||||||
|
end
|
||||||
|
if Verso(J,1) && Verso (J,2) == 1 % Calcolo Orario per entrambi i punti (standard)
|
||||||
|
S_fin(J,1) = ((X1f(N1)- X2f(N2)).^2+(Z1f(N1)-Z2f(N2)).^2).^0.5;
|
||||||
|
S_ini(J,1) = ((X1(N1)- X2(N2)).^2+(Z1(N1)-Z2(N2)).^2).^0.5;
|
||||||
|
SegStar(J,1) = S_fin(J,1) - S_ini(J,1);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
25
ATD/DB_date_time.m
Executable file
25
ATD/DB_date_time.m
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
function idElabData = DB_date_time(IDcentralina,DTcatena,NodeNum,ListaDate,ARRAYdate,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
idElabData = zeros(l,1); % Contiene gli id delle date delle quali ho già dati
|
||||||
|
cc = 1; % contatore
|
||||||
|
for ii=1:l
|
||||||
|
dString = datestr(ARRAYdate(ii),'yyyy-mm-dd');
|
||||||
|
tString = datestr(ARRAYdate(ii),'HH:MM:SS');
|
||||||
|
|
||||||
|
comando = ['select idElabData from ELABDATADISP where UnitName = ''' ...
|
||||||
|
IDcentralina ''' and ToolNameID = ''' DTcatena ''' and NodeNum = ''' ...
|
||||||
|
nNodo ''' and EventDate = ''' dString ''' and EventTime = ''' tString ''' order by EventDate'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
idDate = curs.Data;
|
||||||
|
if strcmp(idDate,'No Data')
|
||||||
|
idElabData(cc,1) = 0; % 0 indica che il dato non è presente su DB
|
||||||
|
else
|
||||||
|
idElabData(cc,1) = cell2mat(idDate);
|
||||||
|
end
|
||||||
|
cc = cc+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
41
ATD/DBwrite2DCrL.m
Executable file
41
ATD/DBwrite2DCrL.m
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
function DBwrite2DCrL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,...
|
||||||
|
DTcatena,Ch2DCrL,CrL2D_NTC,cont2DCrL,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if idData == 0 % Se la data non è su DB (=0), scrivo i dati
|
||||||
|
if Ch2DCrL(cont2DCrL) >= 2 && CrL2D_NTC(cont2DCrL) == 1 % scrivo la T
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'XShift','YShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7),...
|
||||||
|
DATAinsert(ii,8),DATAinsert(ii,9)];
|
||||||
|
else
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'XShift','YShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7),...
|
||||||
|
DATAinsert(ii,9)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
if Ch2DCrL(cont2DCrL) >= 2 && CrL2D_NTC(cont2DCrL) == 1 % scrivo la T
|
||||||
|
colnames = {'XShift','YShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9)];
|
||||||
|
else
|
||||||
|
colnames = {'XShift','YShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,9)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
41
ATD/DBwrite3DCrL.m
Executable file
41
ATD/DBwrite3DCrL.m
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
function DBwrite3DCrL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,...
|
||||||
|
DTcatena,Ch3DCrL,CrL3D_NTC,cont3DCrL,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
if Ch3DCrL(cont3DCrL) >= 4 && CrL3D_NTC(cont3DCrL) == 1 % scrivo la T
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'XShift','YShift','ZShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7),...
|
||||||
|
DATAinsert(ii,8),DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'XShift','YShift','ZShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7),...
|
||||||
|
DATAinsert(ii,8),DATAinsert(ii,10)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
if Ch3DCrL(cont3DCrL) >= 4 && CrL3D_NTC(cont3DCrL) == 1 % scrivo la T
|
||||||
|
colnames = {'XShift','YShift','ZShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else
|
||||||
|
colnames = {'XShift','YShift','ZShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,10)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
39
ATD/DBwrite3DEL.m
Executable file
39
ATD/DBwrite3DEL.m
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
function DBwrite3DEL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,...
|
||||||
|
DTcatena,Ch3DEL,c3DEL_NTC,EL3D_NTC,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non è su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if Ch3DEL(c3DEL_NTC) == 4 && EL3D_NTC(c3DEL_NTC) == 1 % scrivo la T
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','YShift','ZShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else % NON scrivo la T
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','YShift','ZShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,10)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if Ch3DEL(c3DEL_NTC) == 4 && EL3D_NTC(c3DEL_NTC) == 1 % scrivo la T
|
||||||
|
colnames = {'XShift','YShift','ZShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else % NON scrivo la T
|
||||||
|
colnames = {'XShift','YShift','ZShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,10)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
38
ATD/DBwriteCrL.m
Executable file
38
ATD/DBwriteCrL.m
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
function DBwriteCrL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,...
|
||||||
|
DTcatena,cCrL,ChCrL,CrL_NTC,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChCrL(cCrL) >= 2 && CrL_NTC(cCrL) == 1 % scrivo la T
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
else
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChCrL(cCrL) >= 2 && CrL_NTC(cCrL) == 1 % scrivo la T
|
||||||
|
colnames = {'XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
else
|
||||||
|
colnames = {'XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
65
ATD/DBwriteEL.m
Executable file
65
ATD/DBwriteEL.m
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
function DBwriteEL(DATAinsert,idElabData,ListaDate,NodeNum,Calcolo_Carico,...
|
||||||
|
IDcentralina,DTcatena,cEL,ChEL,EL_NTC,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChEL(cEL) >= 2 && EL_NTC(cEL) == 1 % scrivo la T
|
||||||
|
if Calcolo_Carico == 1 % scrivo sforzo e carico
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate',...
|
||||||
|
'EventTime','XShift','T_node','calcerr','load_value','pressure'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7),...
|
||||||
|
DATAinsert(ii,8),DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
else % NON scrivo la T
|
||||||
|
if Calcolo_Carico == 1 % scrivo sforzo e carico
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'XShift','calcerr','load_value','pressure'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChEL(cEL) >= 2 && EL_NTC(cEL) == 1 % scrivo la T
|
||||||
|
if Calcolo_Carico == 1
|
||||||
|
colnames = {'XShift','T_node','calcerr','load_value','pressure'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else
|
||||||
|
colnames = {'XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
else % NON scrivo la T
|
||||||
|
if Calcolo_Carico == 1
|
||||||
|
colnames = {'XShift','calcerr','load_value','pressure'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,8),DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
else
|
||||||
|
colnames = {'XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
25
ATD/DBwriteLL.m
Executable file
25
ATD/DBwriteLL.m
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
function DBwriteLL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non è su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','load_value','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),DATAinsert(ii,4),...
|
||||||
|
DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7)];
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'load_value'};
|
||||||
|
data = DATAinsert(ii,6);
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,4))...
|
||||||
|
''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
73
ATD/DBwriteMPBEL.m
Executable file
73
ATD/DBwriteMPBEL.m
Executable file
@@ -0,0 +1,73 @@
|
|||||||
|
function DBwriteMPBEL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,...
|
||||||
|
DTcatena,NumBasi,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if NumBasi == 1
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate',...
|
||||||
|
'EventTime','XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7)];
|
||||||
|
elseif NumBasi == 2
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate',...
|
||||||
|
'EventTime','XShift','YShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
elseif NumBasi == 3
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate',...
|
||||||
|
'EventTime','XShift','YShift','ZShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9)];
|
||||||
|
elseif NumBasi == 4
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate',...
|
||||||
|
'EventTime','XShift','YShift','ZShift','X','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10)];
|
||||||
|
elseif NumBasi == 5
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate',...
|
||||||
|
'EventTime','XShift','YShift','ZShift','X','Y','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10,DATAinsert(ii,11))];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if NumBasi == 1
|
||||||
|
colnames = {'XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7)];
|
||||||
|
elseif NumBasi == 2
|
||||||
|
colnames = {'XShift','YShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
elseif NumBasi == 3
|
||||||
|
colnames = {'XShift','YShift','ZShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9)];
|
||||||
|
elseif NumBasi == 4
|
||||||
|
colnames = {'XShift','YShift','ZShift','X','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10)];
|
||||||
|
elseif NumBasi == 5
|
||||||
|
colnames = {'XShift','YShift','ZShift','X','Y','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10,DATAinsert(ii,11))];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
75
ATD/DBwritePCL.m
Executable file
75
ATD/DBwritePCL.m
Executable file
@@ -0,0 +1,75 @@
|
|||||||
|
function DBwritePCL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
checkA = isnan(cell2mat(DATAinsert(ii,15)));
|
||||||
|
if checkA == 1 % il vettore accelerazione č NaN
|
||||||
|
checkV = isnan(cell2mat(DATAinsert(ii,13)));
|
||||||
|
if checkV == 1 % il vettore velocitŕ č NaN
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,17)];
|
||||||
|
else % velocitŕ č un numero, accelerazione NaN
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node',...
|
||||||
|
'speed','speed_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
else % scrivo tutto
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','speed',...
|
||||||
|
'speed_local','acceleration','acceleration_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,15),...
|
||||||
|
DATAinsert(ii,16),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
checkA = isnan(cell2mat(DATAinsert(ii,15)));
|
||||||
|
if checkA == 1 % il vettore accelerazione č NaN
|
||||||
|
checkV = isnan(cell2mat(DATAinsert(ii,13)));
|
||||||
|
if checkV == 1 % il vettore velocitŕ č NaN
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,17)];
|
||||||
|
else % velocitŕ č un numero, accelerazione NaN
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node',...
|
||||||
|
'speed','speed_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
else % scrivo tutto
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','speed',...
|
||||||
|
'speed_local','acceleration','acceleration_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
DATAinsert(ii,15),DATAinsert(ii,16),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = ''' DTcatena ''' and NodeNum = ''' ...
|
||||||
|
nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
35
ATD/DBwritePCLHR.m
Executable file
35
ATD/DBwritePCLHR.m
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
function DBwritePCLHR(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'ToolNameID','NodeNum','EventDate','EventTime','X',...
|
||||||
|
'Y','Z','XShift','YShift','ZShift','HShift_local',...
|
||||||
|
'T_node','week_shift','week_shift_x','week_shift_y','week_shift_z'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,15),...
|
||||||
|
DATAinsert(ii,16)];
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'X','Y','Z','XShift','YShift','ZShift',...
|
||||||
|
'HShift_local','T_node','week_shift','week_shift_x','week_shift_y','week_shift_z'};
|
||||||
|
data = [DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7),...
|
||||||
|
DATAinsert(ii,8),DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12), DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,15),...
|
||||||
|
DATAinsert(ii,16)];
|
||||||
|
whereclause = ['WHERE ToolNameID = ''' DTcatena ''' and NodeNum = ''' ...
|
||||||
|
nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,3))...
|
||||||
|
''' and EventTime = ''' cell2mat(DATAinsert(ii,4)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
24
ATD/DBwritePL.m
Executable file
24
ATD/DBwritePL.m
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
function DBwritePL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','pressure','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),DATAinsert(ii,4),...
|
||||||
|
DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,7)];
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'pressure'};
|
||||||
|
data = DATAinsert(ii,6);
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,4))...
|
||||||
|
''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
30
ATD/DBwriteRL.m
Executable file
30
ATD/DBwriteRL.m
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
function DBwriteRL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','X',...
|
||||||
|
'Y','Z','XShift','YShift','ZShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),DATAinsert(ii,13)];
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'X','Y','Z','XShift','YShift','ZShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),...
|
||||||
|
DATAinsert(ii,8),DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13)];
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = ''' ...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,4))...
|
||||||
|
''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
38
ATD/DBwriteSM.m
Executable file
38
ATD/DBwriteSM.m
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
function DBwriteSM(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,...
|
||||||
|
DTcatena,ChSM,SM_NTC,cSM,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChSM(cSM) >= 2 && SM_NTC(cSM) == 1 % scrivo la T
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
else
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChSM(cSM) >= 2 && SM_NTC(cSM) == 1 % scrivo la T
|
||||||
|
colnames = {'XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
else
|
||||||
|
colnames = {'XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
75
ATD/DBwriteTLH.m
Executable file
75
ATD/DBwriteTLH.m
Executable file
@@ -0,0 +1,75 @@
|
|||||||
|
function DBwriteTLH(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
checkA = isnan(cell2mat(DATAinsert(ii,15)));
|
||||||
|
if checkA == 1 % il vettore accelerazione č NaN
|
||||||
|
checkV = isnan(cell2mat(DATAinsert(ii,13)));
|
||||||
|
if checkV == 1 % il vettore velocitŕ č NaN
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,17)];
|
||||||
|
else % velocitŕ č un numero, accelerazione NaN
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node',...
|
||||||
|
'speed','speed_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
else % scrivo tutto
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','speed',...
|
||||||
|
'speed_local','acceleration','acceleration_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,15),...
|
||||||
|
DATAinsert(ii,16),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
checkA = isnan(cell2mat(DATAinsert(ii,15)));
|
||||||
|
if checkA == 1 % il vettore accelerazione č NaN
|
||||||
|
checkV = isnan(cell2mat(DATAinsert(ii,13)));
|
||||||
|
if checkV == 1 % il vettore velocitŕ č NaN
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,17)];
|
||||||
|
else % velocitŕ č un numero, accelerazione NaN
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node',...
|
||||||
|
'speed','speed_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
else % scrivo tutto
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','speed',...
|
||||||
|
'speed_local','acceleration','acceleration_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
DATAinsert(ii,15),DATAinsert(ii,16),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = ''' DTcatena ''' and NodeNum = ''' ...
|
||||||
|
nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
75
ATD/DBwriteTLHRH.m
Executable file
75
ATD/DBwriteTLHRH.m
Executable file
@@ -0,0 +1,75 @@
|
|||||||
|
function DBwriteTLHRH(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
checkA = isnan(cell2mat(DATAinsert(ii,15)));
|
||||||
|
if checkA == 1 % il vettore accelerazione č NaN
|
||||||
|
checkV = isnan(cell2mat(DATAinsert(ii,13)));
|
||||||
|
if checkV == 1 % il vettore velocitŕ č NaN
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,17)];
|
||||||
|
else % velocitŕ č un numero, accelerazione NaN
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node',...
|
||||||
|
'speed','speed_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
else % scrivo tutto
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime',...
|
||||||
|
'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','speed',...
|
||||||
|
'speed_local','acceleration','acceleration_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,15),...
|
||||||
|
DATAinsert(ii,16),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
checkA = isnan(cell2mat(DATAinsert(ii,15)));
|
||||||
|
if checkA == 1 % il vettore accelerazione č NaN
|
||||||
|
checkV = isnan(cell2mat(DATAinsert(ii,13)));
|
||||||
|
if checkV == 1 % il vettore velocitŕ č NaN
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,17)];
|
||||||
|
else % velocitŕ č un numero, accelerazione NaN
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node',...
|
||||||
|
'speed','speed_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
else % scrivo tutto
|
||||||
|
colnames = {'Y','Z','YShift','ZShift','AlfaX','AlfaY','T_node','speed',...
|
||||||
|
'speed_local','acceleration','acceleration_local','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
DATAinsert(ii,15),DATAinsert(ii,16),DATAinsert(ii,17)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = ''' DTcatena ''' and NodeNum = ''' ...
|
||||||
|
nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
45
ATD/DBwriteTuL.m
Executable file
45
ATD/DBwriteTuL.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
function DBwriteTuL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','X','Xstar',...
|
||||||
|
'Y','Z','Zstar','XShift','YShift','ZShift','HShift','HShift_local',...
|
||||||
|
'T_node','speed_local','acceleration_local','Area','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8),DATAinsert(ii,9),...
|
||||||
|
DATAinsert(ii,10),DATAinsert(ii,11),DATAinsert(ii,12),...
|
||||||
|
DATAinsert(ii,13),DATAinsert(ii,14),DATAinsert(ii,15),...
|
||||||
|
DATAinsert(ii,16),DATAinsert(ii,17),DATAinsert(ii,18),...
|
||||||
|
DATAinsert(ii,19),DATAinsert(ii,20)];
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
% colnames = {'X','Xstar','Y','Z','Zstar','XShift','YShift','ZShift','HShift',...
|
||||||
|
% 'HShift_local','T_node','speed_local','acceleration_local','Area'};
|
||||||
|
% data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8),...
|
||||||
|
% DATAinsert(ii,9),DATAinsert(ii,10),DATAinsert(ii,11),...
|
||||||
|
% DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
% DATAinsert(ii,15),DATAinsert(ii,16),DATAinsert(ii,17),...
|
||||||
|
% DATAinsert(ii,18)];
|
||||||
|
colnames = {'X','Y','Z','XShift','YShift','ZShift','HShift',...
|
||||||
|
'HShift_local','T_node','speed_local','acceleration_local','Area'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,8),...
|
||||||
|
DATAinsert(ii,9),DATAinsert(ii,11),...
|
||||||
|
DATAinsert(ii,12),DATAinsert(ii,13),DATAinsert(ii,14),...
|
||||||
|
DATAinsert(ii,15),DATAinsert(ii,16),DATAinsert(ii,17),...
|
||||||
|
DATAinsert(ii,18)];
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = ''' ...
|
||||||
|
DTcatena ''' and NodeNum = ''' ...
|
||||||
|
nNodo ''' and EventDate = ''' cell2mat(DATAinsert(ii,4))...
|
||||||
|
''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
37
ATD/DBwriteWEL.m
Executable file
37
ATD/DBwriteWEL.m
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
function DBwriteWEL(DATAinsert,idElabData,ListaDate,NodeNum,IDcentralina,DTcatena,...
|
||||||
|
cWEL,ChWEL,WEL_NTC,conn)
|
||||||
|
|
||||||
|
nNodo = num2str(NodeNum);
|
||||||
|
l = ListaDate;
|
||||||
|
for ii=1:l
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
if idData == 0 % Se la data non č su DB (=0), scrivo i dati
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChWEL(cWEL) >= 2 && WEL_NTC(cWEL) == 1 % scrivo la T
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),...
|
||||||
|
DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
else
|
||||||
|
colnames = {'UnitName','ToolNameID','NodeNum','EventDate','EventTime','XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
tablename = 'ELABDATADISP';
|
||||||
|
if ChWEL(cWEL) >= 2 && WEL_NTC(cWEL) == 1 % scrivo la T
|
||||||
|
colnames = {'XShift','T_node','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,7),DATAinsert(ii,8)];
|
||||||
|
else
|
||||||
|
colnames = {'XShift','calcerr'};
|
||||||
|
data = [DATAinsert(ii,6),DATAinsert(ii,8)];
|
||||||
|
end
|
||||||
|
whereclause = ['WHERE UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeNum = ''' nNodo ''' and EventDate = ''' ...
|
||||||
|
cell2mat(DATAinsert(ii,4)) ''' and EventTime = ''' cell2mat(DATAinsert(ii,5)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
15
ATD/IDunit.m
Executable file
15
ATD/IDunit.m
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
function unitID = IDunit(IDcentralina,conn,FileName)
|
||||||
|
|
||||||
|
text = 'IDunit function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
comando = ['select id from units where name like ''' IDcentralina ''' '];
|
||||||
|
unitID = fetch(conn,comando);
|
||||||
|
|
||||||
|
text = 'Unit ID downloaded correctly, IDunit function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
2697
ATD/LastElab.m
Executable file
2697
ATD/LastElab.m
Executable file
File diff suppressed because it is too large
Load Diff
45
ATD/LastElab_bisAL.m
Executable file
45
ATD/LastElab_bisAL.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
function DatiElabAnalogLink = LastElab_bisAL(conn,NodoAnalogLink,rAL,...
|
||||||
|
datainiAL,tempoiniAL,IDcentralina,DTcatena,FileName)
|
||||||
|
|
||||||
|
text = 'LastElab_bisAL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
NAnalogLink = cell2mat(NodoAnalogLink(:,2));
|
||||||
|
NodeType = 'Analog Link';
|
||||||
|
ii = 1; % contatore
|
||||||
|
col = 8; % contatore colonne
|
||||||
|
while ii <= rAL
|
||||||
|
ini_col = col-7;
|
||||||
|
nN = num2str(NAnalogLink(ii,1));
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z from ElabDataView where EventDate = ''' ...
|
||||||
|
datainiAL ''' and EventTime >= ''' tempoiniAL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoALd = curs.Data;
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z from ElabDataView where EventDate > ''' ...
|
||||||
|
datainiAL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoAL = curs.Data;
|
||||||
|
[~,c1] = size(DATnodoAL);
|
||||||
|
[~,c2] = size(DATnodoALd);
|
||||||
|
if c1 == c2
|
||||||
|
DATnodoAL = [DATnodoALd; DATnodoAL];
|
||||||
|
elseif c1 < c2 % solo giorno di riferimento
|
||||||
|
DATnodoAL = DATnodoALd;
|
||||||
|
end
|
||||||
|
DatiElabAnalogLink(:,ini_col:col) = DATnodoAL(:,:);
|
||||||
|
col = col+8;
|
||||||
|
ii = ii+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'LastElab_bisAL function worked correctly for Analog Link';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
45
ATD/LastElab_bisPCL.m
Executable file
45
ATD/LastElab_bisPCL.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
function DatiElabPreConvLink = LastElab_bisPCL(conn,NodoPreConvLink,rPCL,...
|
||||||
|
datainiPCL,tempoiniPCL,IDcentralina,DTcatena,FileName)
|
||||||
|
|
||||||
|
text = 'LastElab_bisPCL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
NPreConvLink = cell2mat(NodoPreConvLink(:,2));
|
||||||
|
NodeType = 'PreConv Link';
|
||||||
|
ii = 1; % contatore
|
||||||
|
col = 13; % contatore colonne
|
||||||
|
while ii <= rPCL
|
||||||
|
ini_col = col-12;
|
||||||
|
nN = num2str(NPreConvLink(ii,1));
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, YShift, ZShift, Y, Z, AlfaX, AlfaY, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate = ''' ...
|
||||||
|
datainiPCL ''' and EventTime >= ''' tempoiniPCL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoPCLd = curs.Data;
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, YShift, ZShift, Y, Z, AlfaX, AlfaY, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate > ''' ...
|
||||||
|
datainiPCL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoPCL = curs.Data;
|
||||||
|
[~,c1] = size(DATnodoPCL);
|
||||||
|
[~,c2] = size(DATnodoPCLd);
|
||||||
|
if c1 == c2
|
||||||
|
DATnodoPCL = [DATnodoPCLd; DATnodoPCL];
|
||||||
|
elseif c1 < c2 % solo giorno di riferimento
|
||||||
|
DATnodoPCL = DATnodoPCLd;
|
||||||
|
end
|
||||||
|
DatiElabPreConvLink(:,ini_col:col) = DATnodoPCL(:,:);
|
||||||
|
col = col+13;
|
||||||
|
ii = ii+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'LastElab_bisPCL function worked correctly for PreConv Link';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
45
ATD/LastElab_bisPCLHR.m
Executable file
45
ATD/LastElab_bisPCLHR.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
function DatiElabPreConvLinkHR = LastElab_bisPCLHR(conn,NodoPreConvLinkHR,rPCLHR,...
|
||||||
|
datainiPCLHR,tempoiniPCLHR,IDcentralina,DTcatena,FileName)
|
||||||
|
|
||||||
|
text = 'LastElab_bisPCLHR function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
NPreConvLinkHR = cell2mat(NodoPreConvLinkHR(:,2));
|
||||||
|
NodeType = 'PreConv Link HR';
|
||||||
|
ii = 1; % contatore
|
||||||
|
col = 13; % contatore colonne
|
||||||
|
while ii <= rPCLHR
|
||||||
|
ini_col = col-12;
|
||||||
|
nN = num2str(NPreConvLinkHR(ii,1));
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, YShift, ZShift, Y, Z, AlfaX, AlfaY, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate = ''' ...
|
||||||
|
datainiPCLHR ''' and EventTime >= ''' tempoiniPCLHR ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoPCLHRd = curs.Data;
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, YShift, ZShift, Y, Z, AlfaX, AlfaY, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate > ''' ...
|
||||||
|
datainiPCLHR ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoPCLHR = curs.Data;
|
||||||
|
[~,c1] = size(DATnodoPCLHR);
|
||||||
|
[~,c2] = size(DATnodoPCLHRd);
|
||||||
|
if c1 == c2
|
||||||
|
DATnodoPCLHR = [DATnodoPCLHRd; DATnodoPCLHR];
|
||||||
|
elseif c1 < c2 % solo giorno di riferimento
|
||||||
|
DATnodoPCLHR = DATnodoPCLHRd;
|
||||||
|
end
|
||||||
|
DatiElabPreConvLinkHR(:,ini_col:col) = DATnodoPCLHR(:,:);
|
||||||
|
col = col+13;
|
||||||
|
ii = ii+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'LastElab_bisPCLHR function worked correctly for PreConv Link HR';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
45
ATD/LastElab_bisRL.m
Executable file
45
ATD/LastElab_bisRL.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
function DatiElabRadialLink = LastElab_bisRL(conn,NodoRadialLink,rRL,...
|
||||||
|
datainiRL,tempoiniRL,IDcentralina,DTcatena,FileName)
|
||||||
|
|
||||||
|
text = 'LastElab_bisRL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
NRadialLink = cell2mat(NodoRadialLink(:,2));
|
||||||
|
NodeType = 'Radial Link';
|
||||||
|
ii = 1; % contatore
|
||||||
|
col = 9; % contatore colonne
|
||||||
|
while ii <= rRL
|
||||||
|
ini_col = col-8;
|
||||||
|
nN = num2str(NRadialLink(ii,1));
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, T_node from ElabDataView where EventDate = ''' ...
|
||||||
|
datainiRL ''' and EventTime >= ''' tempoiniRL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoRLd = curs.Data;
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, T_node from ElabDataView where EventDate > ''' ...
|
||||||
|
datainiRL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoRL = curs.Data;
|
||||||
|
[~,c1] = size(DATnodoRL);
|
||||||
|
[~,c2] = size(DATnodoRLd);
|
||||||
|
if c1 == c2
|
||||||
|
DATnodoRL = [DATnodoRLd; DATnodoRL];
|
||||||
|
elseif c1 < c2 % solo giorno di riferimento
|
||||||
|
DATnodoRL = DATnodoRLd;
|
||||||
|
end
|
||||||
|
DatiElabRadialLink(:,ini_col:col) = DATnodoRL(:,:);
|
||||||
|
col = col+9;
|
||||||
|
ii = ii+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'LastElab_bisRL function worked correctly for Radial Link';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
BIN
ATD/LastElab_bisTLH.m
Executable file
BIN
ATD/LastElab_bisTLH.m
Executable file
Binary file not shown.
45
ATD/LastElab_bisTLHRH.m
Executable file
45
ATD/LastElab_bisTLHRH.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
function DatiElabTiltLinkHRH = LastElab_bisTLHRH(conn,NodoTiltLinkHRH,rTLHRH,...
|
||||||
|
datainiTLHRH,tempoiniTLHRH,IDcentralina,DTcatena,FileName)
|
||||||
|
|
||||||
|
text = 'LastElab_bisTLHRH function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
NTiltLinkHRH = cell2mat(NodoTiltLinkHRH(:,2));
|
||||||
|
NodeType = 'Tilt Link HR H';
|
||||||
|
ii = 1; % contatore
|
||||||
|
col = 13; % contatore colonne
|
||||||
|
while ii <= rTLHRH
|
||||||
|
ini_col = col-12;
|
||||||
|
nN = num2str(NTiltLinkHRH(ii,1));
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, YShift, ZShift, Y, Z, AlfaX, AlfaY, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate = ''' ...
|
||||||
|
datainiTLHRH ''' and EventTime >= ''' tempoiniTLHRH ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoTLHRHd = curs.Data;
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, YShift, ZShift, Y, Z, AlfaX, AlfaY, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate > ''' ...
|
||||||
|
datainiTLHRH ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoTLHRH = curs.Data;
|
||||||
|
[~,c1] = size(DATnodoTLHRH);
|
||||||
|
[~,c2] = size(DATnodoTLHRHd);
|
||||||
|
if c1 == c2
|
||||||
|
DATnodoTLHRH = [DATnodoTLHRHd; DATnodoTLHRH];
|
||||||
|
elseif c1 < c2 % solo giorno di riferimento
|
||||||
|
DATnodoTLHRH = DATnodoTLHRHd;
|
||||||
|
end
|
||||||
|
DatiElabTiltLinkHRH(:,ini_col:col) = DATnodoTLHRH(:,:);
|
||||||
|
col = col+13;
|
||||||
|
ii = ii+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'LastElab_bisTLHRH function worked correctly for Tilt Link HR H';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
45
ATD/LastElab_bisTuL.m
Executable file
45
ATD/LastElab_bisTuL.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
function DatiElabTunnelLink = LastElab_bisTuL(conn,NodoTunnelLink,rTuL,...
|
||||||
|
datainiTuL,tempoiniTuL,IDcentralina,DTcatena,FileName)
|
||||||
|
|
||||||
|
text = 'LastElab_bisTuL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
NTunnelLink = cell2mat(NodoTunnelLink(:,2));
|
||||||
|
NodeType = 'Tunnel Link';
|
||||||
|
ii = 1; % contatore
|
||||||
|
col = 16; % contatore colonne
|
||||||
|
while ii <= rTuL
|
||||||
|
ini_col = col-15;
|
||||||
|
nN = num2str(NTunnelLink(ii,1));
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, Xstar, Zstar, HShift, HShift_local, T_node, Area, speed_local, acceleration_local from ElabDataView where EventDate = ''' ...
|
||||||
|
datainiTuL ''' and EventTime >= ''' tempoiniTuL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoTuLd = curs.Data;
|
||||||
|
% Scarico di dati di spostamenti
|
||||||
|
comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, Xstar, Zstar, HShift, HShift_local, T_node, Area, speed_local, acceleration_local from ElabDataView where EventDate > ''' ...
|
||||||
|
datainiTuL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
|
||||||
|
DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
DATnodoTuL = curs.Data;
|
||||||
|
[~,c1] = size(DATnodoTuL);
|
||||||
|
[~,c2] = size(DATnodoTuLd);
|
||||||
|
if c1 == c2
|
||||||
|
DATnodoTuL = [DATnodoTuLd; DATnodoTuL];
|
||||||
|
elseif c1 < c2 % solo giorno di riferimento
|
||||||
|
DATnodoTuL = DATnodoTuLd;
|
||||||
|
end
|
||||||
|
DatiElabTunnelLink(:,ini_col:col) = DATnodoTuL(:,:);
|
||||||
|
col = col+16;
|
||||||
|
ii = ii+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'LastElab_bisTuL function worked correctly for Tunnel Link';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_2DCrL.m
Executable file
28
ATD/MediaDati_2DCrL.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Wire Extensometer Link
|
||||||
|
% DatiWireExtensometer contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_2DCrL,Dati2DCrack] = MediaDati_2DCrL(Dati2DCrack,Time2DCrL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_2DCrL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(Dati2DCrack);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_2DCrL = Time2DCrL;
|
||||||
|
|
||||||
|
%% Dati
|
||||||
|
Dati2DCrack = smoothdata(Dati2DCrack,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for 2D Crack Link processed. MediaDati_2DCrL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_3DCrL.m
Executable file
28
ATD/MediaDati_3DCrL.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Wire Extensometer Link
|
||||||
|
% DatiWireExtensometer contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_3DCrL,Dati3DCrack] = MediaDati_3DCrL(Dati3DCrack,Time3DCrL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_3DCrL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(Dati3DCrack);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_3DCrL = Time3DCrL;
|
||||||
|
|
||||||
|
%% Dati
|
||||||
|
Dati3DCrack = smoothdata(Dati3DCrack,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for 3D Crack Link processed. MediaDati_3DCrL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_3DEL.m
Executable file
28
ATD/MediaDati_3DEL.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i 3D Extensometer Link
|
||||||
|
% DatiExtensometer3D contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_3DEL,DatiExtensometer3D] = MediaDati_3DEL(DatiExtensometer3D,Time3DEL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
text = 'MediaDati_3DEL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(DatiExtensometer3D);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_3DEL = Time3DEL;
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
DatiExtensometer3D = smoothdata(DatiExtensometer3D,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for 3D Extensometer Link have been processed. MediaDati_3DEL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_AL.m
Executable file
28
ATD/MediaDati_AL.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per gli Analog Link
|
||||||
|
% DatiAnalogLink contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_AL,DatiAnalog] = MediaDati_AL(DatiAnalog,TimeAL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_AL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(DatiAnalog);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Dati
|
||||||
|
DatiAnalog = smoothdata(DatiAnalog,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_AL = TimeAL;
|
||||||
|
|
||||||
|
text = 'Average values for Analog Link processed. MediaDati_AL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_CrL.m
Executable file
28
ATD/MediaDati_CrL.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Wire Extensometer Link
|
||||||
|
% DatiWireExtensometer contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_CrL,DatiCrack] = MediaDati_CrL(DatiCrack,TimeCrL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_CrL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(DatiCrack);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_CrL = TimeCrL;
|
||||||
|
|
||||||
|
%% Dati
|
||||||
|
DatiCrack = smoothdata(DatiCrack,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for Crack Link processed. MediaDati_CrL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_EL.m
Executable file
28
ATD/MediaDati_EL.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per gli Extensometer Link
|
||||||
|
% DatiExtensometer contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_EL,DatiExtensometer] = MediaDati_EL(DatiExtensometer,TimeEL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
text = 'MediaDati_EL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(DatiExtensometer);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_EL = TimeEL;
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
DatiExtensometer = smoothdata(DatiExtensometer,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for Extensometer Link have been processed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
25
ATD/MediaDati_LL.m
Executable file
25
ATD/MediaDati_LL.m
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i LoadLink
|
||||||
|
% DatiLoad contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_LL,DatiLoad] = MediaDati_LL(DatiLoad,TimeLL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
[r,~]=size(DatiLoad);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_LL = TimeLL;
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
DatiLoad = smoothdata(DatiLoad,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for Load Link have been processed';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
29
ATD/MediaDati_MPBEL.m
Executable file
29
ATD/MediaDati_MPBEL.m
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Multi Point Rod Extensometer Link
|
||||||
|
% DatiMultiBase contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_MPBEL,DatiMultiBase] = MediaDati_MPBEL(DatiMultiBase,TimeMPBEL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_MPBEL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(DatiMultiBase);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Dati
|
||||||
|
DatiMultiBase = smoothdata(DatiMultiBase,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_MPBEL = TimeMPBEL;
|
||||||
|
|
||||||
|
text = 'Average values for MultiPoint Borehole Rod Extensometer processed. MediaDati_MPBEL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
34
ATD/MediaDati_PCL.m
Executable file
34
ATD/MediaDati_PCL.m
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i PreConv Link
|
||||||
|
% ACCdef_PCL contiene le medie per l'intervallo definito delle accelerazioni
|
||||||
|
% ARRAYdate_PCL contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_PCL,accPCL,ACCdefRis_PCL,TempDef_PCL] = MediaDati_PCL(...
|
||||||
|
accPCL,TimePCL,ris_acc_PCL,NdatiMedia,T_PCL,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_PCL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
[r,~]=size(accPCL);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
accPCL = smoothdata(accPCL,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_PCL = TimePCL;
|
||||||
|
|
||||||
|
%% Risultante acc
|
||||||
|
ACCdefRis_PCL = ris_acc_PCL; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
%% Temperatura
|
||||||
|
TempDef_PCL = T_PCL; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
text = 'Average values for PreConv Link have been processed. MediaDati_PCL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
32
ATD/MediaDati_PCLHR.m
Executable file
32
ATD/MediaDati_PCLHR.m
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Tilt Link HR H
|
||||||
|
% AngDef_PCLHR contiene le medie per l'intervallo definito degli angoli
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_PCLHR,AngDef_PCLHR,TempDef_PCLHR] = MediaDati_PCLHR(...
|
||||||
|
angPCLHR,TimePCLHR,NdatiMedia,tempPCLHR,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_PCLHR function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(angPCLHR);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_PCLHR = TimePCLHR;
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
AngDef_PCLHR = smoothdata(angPCLHR,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Temperatura
|
||||||
|
TempDef_PCLHR = tempPCLHR; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
text = 'Average values for PreConv Link HR have been processed. MediaDati_PCLHR function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
25
ATD/MediaDati_PL.m
Executable file
25
ATD/MediaDati_PL.m
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i PressureLink
|
||||||
|
% DatiPressure contiene le medie per l'intervallo definito delle accelerazioni
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_PL,DatiPressure] = MediaDati_PL(DatiPressure,TimePL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
[r,~]=size(DatiPressure);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_PL = TimePL;
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
DatiPressure = smoothdata(DatiPressure,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for Pressure Link have been processed';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
34
ATD/MediaDati_RL.m
Executable file
34
ATD/MediaDati_RL.m
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i TiltLink
|
||||||
|
% ACCdef contiene le medie per l'intervallo definito delle accelerazioni
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_RL,accRL,ACCdefRis_RL,TempDef_RL] = MediaDati_RL(accRL,...
|
||||||
|
TimeRL,ris_acc_RL,NdatiMedia,T_RL,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_RL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
[r,~]=size(accRL);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
accRL = smoothdata(accRL,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_RL = TimeRL;
|
||||||
|
|
||||||
|
%% Risultante acc
|
||||||
|
ACCdefRis_RL = ris_acc_RL; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
%% Temperatura
|
||||||
|
TempDef_RL = T_RL; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
text = 'Average values for Radial Link have been processed. MediaDati_RL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_SM.m
Executable file
28
ATD/MediaDati_SM.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Wire Extensometer Link
|
||||||
|
% DatiWireExtensometer contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_SM,DatiStress] = MediaDati_SM(DatiStress,TimeSM,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_SM function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(DatiStress);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_SM = TimeSM;
|
||||||
|
|
||||||
|
%% Dati
|
||||||
|
DatiStress = smoothdata(DatiStress,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for Stress Meter processed. MediaDati_SM function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
34
ATD/MediaDati_TLH.m
Executable file
34
ATD/MediaDati_TLH.m
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Tilt Link H
|
||||||
|
% ACCdef_TLH contiene le medie per l'intervallo definito delle accelerazioni
|
||||||
|
% ARRAYdate_TLH contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_TLH,accTLH,ACCdefRis_TLH,TempDef_TLH] = MediaDati_TLH(...
|
||||||
|
accTLH,TimeTLH,ris_acc_TLH,NdatiMedia,tempTLH,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_TLH function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
[r,~]=size(accTLH);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
accTLH = smoothdata(accTLH,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_TLH = TimeTLH;
|
||||||
|
|
||||||
|
%% Risultante acc
|
||||||
|
ACCdefRis_TLH = ris_acc_TLH; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
%% Temperatura
|
||||||
|
TempDef_TLH = tempTLH; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
text = 'Average values for Tilt Link H have been processed. MediaDati_TLH function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
33
ATD/MediaDati_TLHRH.m
Executable file
33
ATD/MediaDati_TLHRH.m
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Tilt Link HR H
|
||||||
|
% AngDef_TLHR contiene le medie per l'intervallo definito delle accelerazioni
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_TLHRH,AngDef_TLHRH,TempDef_TLHRH] = ...
|
||||||
|
MediaDati_TLHRH(angTLHRH,TimeTLHRH,NdatiMedia,tempTLHRH,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_TLHRH function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(angTLHRH);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_TLHRH = TimeTLHRH;
|
||||||
|
|
||||||
|
%% Angoli
|
||||||
|
AngDef_TLHRH = smoothdata(angTLHRH,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Temperatura
|
||||||
|
TempDef_TLHRH = tempTLHRH; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
text = 'Average values for Tilt Link HR H have been processed. MediaDati_TLHRH function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
53
ATD/MediaDati_TuL.m
Executable file
53
ATD/MediaDati_TuL.m
Executable file
@@ -0,0 +1,53 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Tunnel Link
|
||||||
|
% ACCdef contiene le medie per l'intervallo definito delle accelerazioni
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_TuL,accTuL,ACCdefRis_TuL,TempDef_TuL,ay_TuL,ay_TuL_AC] = ...
|
||||||
|
MediaDati_TuL(accTuL,TimeTuL,ris_acc_TuL,ay_TuL,ay_TuL_AC,NdatiMedia,...
|
||||||
|
T_TuL,NuovoZeroTuL,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_TuL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
%% Accelerazione
|
||||||
|
[r,~]=size(accTuL);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
accTuL = smoothdata(accTuL,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_TuL = TimeTuL;
|
||||||
|
|
||||||
|
%% Risultante acc
|
||||||
|
ACCdefRis_TuL = ris_acc_TuL; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
%% Temperatura
|
||||||
|
TempDef_TuL = T_TuL; % Non faccio la media, mi serve il dato come è per applicare i filtri
|
||||||
|
|
||||||
|
%% Dati di riferimento ay
|
||||||
|
if NuovoZeroTuL == 1
|
||||||
|
[r,~] = size(ay_TuL);
|
||||||
|
if r > NdatiMedia
|
||||||
|
ay_TuL = smoothdata(ay_TuL,'gaussian',NdatiMedia);
|
||||||
|
else
|
||||||
|
ay_TuL = smoothdata(ay_TuL,'gaussian',r);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Dati di riferimento ay Arco rovescio
|
||||||
|
[r,~] = size(ay_TuL_AC);
|
||||||
|
if r > NdatiMedia
|
||||||
|
ay_TuL_AC = smoothdata(ay_TuL_AC,'gaussian',NdatiMedia);
|
||||||
|
else
|
||||||
|
ay_TuL_AC = smoothdata(ay_TuL_AC,'gaussian',r);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'Average values for Tunnel Link have been processed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
28
ATD/MediaDati_WEL.m
Executable file
28
ATD/MediaDati_WEL.m
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
% Questa routine calcola le medie (giornaliere o per intervalli definiti)
|
||||||
|
% necessarie per le elaborazioni successive per i Wire Extensometer Link
|
||||||
|
% DatiWireExtensometer contiene le medie per l'intervallo definito
|
||||||
|
% ARRAYdate contiene le date e il tempo per ogni dato (per media
|
||||||
|
% giornaliera, la data di quel giorno)
|
||||||
|
|
||||||
|
function [ARRAYdate_WEL,DatiWireExtensometer] = MediaDati_WEL(DatiWireExtensometer,TimeWEL,NdatiMedia,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'MediaDati_WEL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
[r,~]=size(DatiWireExtensometer);
|
||||||
|
if NdatiMedia > r
|
||||||
|
NdatiMedia = r;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Matrice date
|
||||||
|
ARRAYdate_WEL = TimeWEL;
|
||||||
|
|
||||||
|
%% Dati
|
||||||
|
DatiWireExtensometer = smoothdata(DatiWireExtensometer,'gaussian',NdatiMedia);
|
||||||
|
|
||||||
|
text = 'Average values for Wire Extensometer Link processed. MediaDati_WEL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
231
ATD/NuovaConversione.m
Executable file
231
ATD/NuovaConversione.m
Executable file
@@ -0,0 +1,231 @@
|
|||||||
|
function [DCalTuLTot,DCalRLTot,DCalTLHTot,DCalTLHRHTot,DCalPCLTot,DCalPCLHRTot,...
|
||||||
|
DCalPLTot,DCalLLTot,DCalELTot,DCalEL3DTot,DCalWELTot,DCalMPBELTot,DCalALTot,...
|
||||||
|
DCalCrLTot,DCal3DCrLTot,DCal2DCrLTot] = NuovaConversione(DCalTuLTot,yesTuL,DCalRLTot,yesRL,...
|
||||||
|
DCalTLHTot,yesTLH,DCalTLHRHTot,yesTLHRH,DCalPCLTot,yesPCL,DCalPCLHRTot,yesPCLHR,...
|
||||||
|
DCalPLTot,yesPL,DCalLLTot,yesLL,DCalELTot,yesEL,DCalEL3DTot,yes3DEL,DCalWELTot,yesWEL,...
|
||||||
|
DCalMPBELTot,yesMPBEL,DCalALTot,yesAL,DCalCrLTot,yesCrL,DCal3DCrLTot,yes3DCrL,...
|
||||||
|
DCal2DCrLTot,yes2DCrL,FileName)
|
||||||
|
|
||||||
|
% Conversione del formato dati che usiamo con il database Ase_New
|
||||||
|
|
||||||
|
%% Tunnel Link
|
||||||
|
[r,c] = size(DCalTuLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesTuL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalTuLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalTuLTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Radial Link
|
||||||
|
[r,c] = size(DCalRLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesRL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalRLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalRLTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Tilt Link H
|
||||||
|
[r,c] = size(DCalTLHTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesTLH==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalTLHTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalTLHTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Tilt Link HR H
|
||||||
|
[r,c] = size(DCalTLHRHTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesTLHRH==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalTLHRHTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalTLHRHTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% PreConv Link
|
||||||
|
[r,c] = size(DCalPCLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesPCL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalPCLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalPCLTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% PreConv Link HR
|
||||||
|
[r,c] = size(DCalPCLHRTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesPCLHR==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalPCLHRTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalPCLHRTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Pressure Link
|
||||||
|
[r,c] = size(DCalPLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesPL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalPLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalPLTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Load Link
|
||||||
|
[r,c] = size(DCalLLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesLL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
if DCalLLTot{ii,jj} == []
|
||||||
|
MATconv(ii,jj) = [];
|
||||||
|
else
|
||||||
|
MATconv(ii,jj) = DCalLLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalLLTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Extensometer Link
|
||||||
|
[r,c] = size(DCalELTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesEL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalELTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalELTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% 3D Extensometer Link
|
||||||
|
[r,c] = size(DCalEL3DTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yes3DEL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalEL3DTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalEL3DTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Wire Extensometer Link
|
||||||
|
[r,c] = size(DCalWELTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesWEL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalWELTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalWELTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Multi Point Borehole Extensometer Link
|
||||||
|
[r,c] = size(DCalMPBELTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesMPBEL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalMPBELTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalMPBELTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Analog Link
|
||||||
|
[r,c] = size(DCalALTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesAL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalALTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalALTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Crack Link
|
||||||
|
[r,c] = size(DCalCrLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yesCrL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCalCrLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCalCrLTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% 3D Crack Link
|
||||||
|
[r,c] = size(DCal3DCrLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yes3DCrL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCal3DCrLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCal3DCrLTot = MATconv;
|
||||||
|
end
|
||||||
|
|
||||||
|
%% 2D Crack Link
|
||||||
|
[r,c] = size(DCal2DCrLTot);
|
||||||
|
MATconv = zeros(r,c);
|
||||||
|
if yes2DCrL==0 % Non ci sono dati
|
||||||
|
else
|
||||||
|
for ii = 1:r
|
||||||
|
for jj = 1:c
|
||||||
|
MATconv(ii,jj) = DCal2DCrLTot{ii,jj};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DCal2DCrLTot = MATconv;
|
||||||
|
end
|
||||||
|
% Apro file di testo
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
|
||||||
|
text = 'NuovaConversione function worked correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
90
ATD/Parametri_Installazione.m
Executable file
90
ATD/Parametri_Installazione.m
Executable file
@@ -0,0 +1,90 @@
|
|||||||
|
%% Funzione che definisce i parametri specifici di elaborazione
|
||||||
|
|
||||||
|
function [NdatiMedia,Ndatidespike,MEMS,tolleranzaAcc,Tmax,Tmin,Ndevst,Wdevst,...
|
||||||
|
Ndevst_HR,Wdevst_HR,NumBasi,elab_option,Calcolo_Carico,Area,Mod_Elastico,...
|
||||||
|
Carico_Ini] = Parametri_Installazione(idTool,conn,yesTuL,yesRL,...
|
||||||
|
yesTLH,yesTLHRH,yesPCL,yesPCLHR,yesMPBEL,yesWEL,yesEL,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Parametri_Installazione function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
comando = ['select avg, despike from software where tool_id like ''' idTool ''' '];
|
||||||
|
Dati = fetch(conn,comando);
|
||||||
|
NdatiMedia = cell2mat(Dati(1));
|
||||||
|
Ndatidespike = cell2mat(Dati(2));
|
||||||
|
|
||||||
|
%% MEMS
|
||||||
|
if yesTuL == 1 || yesTLH == 1 || yesRL == 1 || yesPCL == 1
|
||||||
|
comando = ['select mems, toll_Acc, num_Ds, win_Ds from software where tool_id like ''' idTool ''' '];
|
||||||
|
Dati = fetch(conn,comando);
|
||||||
|
MEMS = cell2mat(Dati(1));
|
||||||
|
tolleranzaAcc = cell2mat(Dati(2));
|
||||||
|
Ndevst = cell2mat(Dati(3));
|
||||||
|
Wdevst = cell2mat(Dati(4));
|
||||||
|
else
|
||||||
|
MEMS = [];
|
||||||
|
tolleranzaAcc = [];
|
||||||
|
Ndevst = [];
|
||||||
|
Wdevst = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Elettrolitici
|
||||||
|
if yesTLHRH == 1 || yesPCLHR == 1
|
||||||
|
comando = ['select num_Ds_HR, win_Ds_HR from software where tool_id like ''' idTool ''' '];
|
||||||
|
Dati = fetch(conn,comando);
|
||||||
|
Ndevst_HR = cell2mat(Dati(1));
|
||||||
|
Wdevst_HR = cell2mat(Dati(2));
|
||||||
|
else
|
||||||
|
Ndevst_HR = [];
|
||||||
|
Wdevst_HR = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
if yesTuL == 1 || yesTLH == 1 || yesRL == 1 || yesPCL == 1 || yesTLHRH == 1 || yesPCLHR == 1 || ...
|
||||||
|
yesWEL == 1
|
||||||
|
comando = ['select max_temp, min_temp from software where tool_id like ''' idTool ''' '];
|
||||||
|
Dati = fetch(conn,comando);
|
||||||
|
Tmax = cell2mat(Dati(1));
|
||||||
|
Tmin = cell2mat(Dati(2));
|
||||||
|
else
|
||||||
|
Tmax = [];
|
||||||
|
Tmin = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
if yesRL == 1 || yesTLH == 1 || yesPCL == 1
|
||||||
|
comando = ['select orientation from software where tool_id like ''' idTool ''' '];
|
||||||
|
Dati = fetch(conn,comando);
|
||||||
|
elab_option = cell2mat(Dati(1));
|
||||||
|
else
|
||||||
|
elab_option = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
if yesEL == 1
|
||||||
|
comando = ['select calcolo_carico, area, mod_elastico, carico_iniziale '...
|
||||||
|
'from software where tool_id like ''' idTool ''' '];
|
||||||
|
Dati = fetch(conn,comando);
|
||||||
|
Calcolo_Carico = cell2mat(Dati(1));
|
||||||
|
Area = cell2mat(Dati(2));
|
||||||
|
Mod_Elastico = cell2mat(Dati(3));
|
||||||
|
Carico_Ini = cell2mat(Dati(4));
|
||||||
|
else
|
||||||
|
Calcolo_Carico = [];
|
||||||
|
Area = [];
|
||||||
|
Mod_Elastico = [];
|
||||||
|
Carico_Ini = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
if yesMPBEL == 1
|
||||||
|
comando = ['select base_num from software where tool_id like ''' idTool ''' '];
|
||||||
|
Dati = fetch(conn,comando);
|
||||||
|
NumBasi = cell2mat(Dati(1));
|
||||||
|
else
|
||||||
|
NumBasi = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'Chain parameters defined correctly and Parametri_Installazione function ended';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
45
ATD/Recharge.m
Executable file
45
ATD/Recharge.m
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
Dati = xlsread('Pasteur.xlsx',4);
|
||||||
|
[r,c] = size(Dati);
|
||||||
|
d = r/5;
|
||||||
|
t = 1;
|
||||||
|
n = 1;
|
||||||
|
cont = 1;
|
||||||
|
ARRAYdate_TuL = zeros(d,1);
|
||||||
|
Xlocal_TuL = zeros(5,d);
|
||||||
|
Ylocal_TuL = zeros(5,d);
|
||||||
|
Zlocal_TuL = zeros(5,d);
|
||||||
|
X_TuL = zeros(5,d);
|
||||||
|
Y_TuL = zeros(5,d);
|
||||||
|
Z_TuL = zeros(5,d);
|
||||||
|
SegStar = zeros(5,d);
|
||||||
|
HShift_local_TuL = zeros(5,d);
|
||||||
|
Area_TuL = zeros(1,d);
|
||||||
|
Speed_local_TuL = zeros(5,d);
|
||||||
|
Acceleration_local_TuL = zeros(5,d);
|
||||||
|
TempDef_TuL = zeros(d,5);
|
||||||
|
ErrTunnelLink = zeros(5,d);
|
||||||
|
for i=1:r
|
||||||
|
Xlocal_TuL(t,cont) = Dati(i,6);
|
||||||
|
Ylocal_TuL(t,cont) = Dati(i,7);
|
||||||
|
Zlocal_TuL(t,cont) = Dati(i,8);
|
||||||
|
X_TuL(t,cont) = Dati(i,9);
|
||||||
|
Y_TuL(t,cont) = Dati(i,10);
|
||||||
|
Z_TuL(t,cont) = Dati(i,11);
|
||||||
|
SegStar(t,cont) = Dati(i,12);
|
||||||
|
HShift_local_TuL(t,cont) = Dati(i,14);
|
||||||
|
Speed_local_TuL(t,cont) = Dati(i,16);
|
||||||
|
Acceleration_local_TuL(t,cont) = Dati(i,18);
|
||||||
|
TempDef_TuL(cont,t) = Dati(i,19);
|
||||||
|
ErrTunnelLink(t,cont) = Dati(i,25);
|
||||||
|
if t == 1
|
||||||
|
ARRAYdate_TuL(n,1) = Dati(i,2)+693960;
|
||||||
|
n = n+1;
|
||||||
|
end
|
||||||
|
t = t+1;
|
||||||
|
if t == 6
|
||||||
|
t = 1;
|
||||||
|
cont = cont+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Xstar_TuL = X_TuL;
|
||||||
|
Zstar_TuL = Z_TuL;
|
||||||
770
ATD/Report.m
Executable file
770
ATD/Report.m
Executable file
@@ -0,0 +1,770 @@
|
|||||||
|
function Report(Mail,siteID,unitID,chainID,alarms,Chain_Scheme,...
|
||||||
|
time,conn,num_nodi,meseadesso,adesso,datainvio,numgiorni,activeEN,...
|
||||||
|
Users_Report,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Report Software started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
recipients_ASE{1,1} = 'alessandro.valletta@aseltd.eu';
|
||||||
|
recipients_ASE{2,1} = 'andrea.carri@aseltd.eu';
|
||||||
|
recipients_ASE{3,1} = 'roberto.savi@aseltd.eu';
|
||||||
|
Mail_ASE = 1;
|
||||||
|
|
||||||
|
if Mail_ASE == 1 || Mail == 1
|
||||||
|
|
||||||
|
% Importo librerie Matlab Report Generator e creo report
|
||||||
|
import mlreportgen.dom.*
|
||||||
|
import mlreportgen.report.*
|
||||||
|
|
||||||
|
FIG = 1; % Contatore Figure
|
||||||
|
FIG_ENG = 1;
|
||||||
|
NomeReport = (['Report_ASE_' siteID]);
|
||||||
|
rpt = Report(NomeReport, 'pdf'); % Crea report
|
||||||
|
NomeReport_ENG = (['Report_ASE_' siteID '_ENG']);
|
||||||
|
rpt_ENG = Report(NomeReport_ENG, 'pdf'); % Crea report
|
||||||
|
Section.number(rpt,false); % elimina numerazione capitoli
|
||||||
|
Section.number(rpt_ENG,false); % elimina numerazione capitoli
|
||||||
|
Font_caption = '8.5pt';
|
||||||
|
Font_table = '9pt';
|
||||||
|
Font_section = '14pt';
|
||||||
|
Font_tools = '12pt';
|
||||||
|
Font_Chapter = '16pt';
|
||||||
|
|
||||||
|
%% Ricavo info sul sito
|
||||||
|
|
||||||
|
% Uso il siteID per identificare il nome del sito
|
||||||
|
comando = ['select name from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
NomeSito = num2str(cell2mat(curs.Data));
|
||||||
|
|
||||||
|
[arraysito,arraysitoENG,controlsito,yesTL,yesTLHR,yesTLH,yesTLHRH,yesPL,yesBL,yesLL,...
|
||||||
|
yesRL,yesKL,yesKLHR,yesThL,yesPT100,yesIPL,yesIPLHR,yesTuL,yesRaL,yesPCL,yesPCLHR,...
|
||||||
|
yesPrL,yesEL,yes3DEL,yesWEL,yesMPBEL,yesCrL,yes3DCrL,yesBML,yesHL,...
|
||||||
|
yesLuxL,yesCO2,yesRSN,yesRSNHR,yesTrL,yesSM,yes2DCrL,yesPE,yesWL,yesGF,yesGS,...
|
||||||
|
rTL,rTLHR,rTLH,rTLHRH,rPL,rBL,rLL,rRL,rKL,rKLHR,rThL,rPT100,rIPL,rIPLHR,rTuL,rRaL,...
|
||||||
|
rPCL,rPCLHR,rPrL,rEL,r3DEL,rWEL,rMPBEL,rCrL,r3DCrL,rBML,rHL,rLuxL,rCO2,rRSN,rRSNHR,...
|
||||||
|
rTrL,rSM,r2DCrL,rPE,rWL,rGF,rGS,nCT,...
|
||||||
|
NodoTiltLink,NodoTiltLinkHR,NodoTiltLinkH,NodoTiltLinkHRH,NodoPiezoLink,NodoBaroLink,...
|
||||||
|
NodoLoadLink,NodoRainLink,NodoKlinoLink,NodoKlinoLinkHR,NodoThermLink,NodoPT100Link,...
|
||||||
|
NodoInPlaceLink,NodoInPlaceLinkHR,NodoTunnelLink,NodoRadialLink,NodoPreConvLink,...
|
||||||
|
NodoPreConvLinkHR,NodoPressureLink,NodoExtensometerLink,Nodo3DExtensometerLink,...
|
||||||
|
NodoWireExtensometerLink,NodoMultiPointExtensometerLink,NodoCrackLink,Nodo3DCrackLink,...
|
||||||
|
NodoBaroMusaLink,NodoHumidityLink,NodoLuxLink,NodoCO2Link,NodoRSNLink,NodoRSNHRLink,...
|
||||||
|
NodoTriggerLink,NodoStressMeter,Nodo2DCrackLink,NodoPendulum,NodoWeirLink,NodoGflowLink,...
|
||||||
|
NodoGshockLink,tipoarray,tipoalarms,nVMS,nTL,nCAM,nAL] = info_Sito(chainID,alarms,...
|
||||||
|
Chain_Scheme,conn,num_nodi,FileName);
|
||||||
|
|
||||||
|
info_sito = [chainID(:,2) chainID(:,4)];
|
||||||
|
|
||||||
|
%% Pagina titolo ITA
|
||||||
|
template_cover(rpt);
|
||||||
|
tp = TitlePage;
|
||||||
|
Titolo = Paragraph(['Report di monitoraggio del sito: ' NomeSito]);
|
||||||
|
Titolo.Style = {HAlign('center'),Bold(1), FontSize('32pt'),OuterMargin('0in','0in','3in','0.2in')};
|
||||||
|
tp.Title = (Titolo);
|
||||||
|
sottotitolo = Paragraph('Report automatico - Versione Beta Test');
|
||||||
|
sottotitolo.Style = {FontSize('12pt'),Bold(1),HAlign('center')};
|
||||||
|
tp.Subtitle = sottotitolo;
|
||||||
|
tp.Author = ' ';
|
||||||
|
datapub = Paragraph(datestr(today,'dd-mm-yyyy'));
|
||||||
|
datapub.Style = {FontSize('12pt'),HAlign('center')};
|
||||||
|
tp.PubDate = datapub;
|
||||||
|
add(rpt,tp);
|
||||||
|
|
||||||
|
if activeEN == 1
|
||||||
|
%% Pagina titolo ENG
|
||||||
|
template_cover(rpt_ENG);
|
||||||
|
tp_ENG = TitlePage;
|
||||||
|
Titolo = Paragraph('Monitoring activity report ');
|
||||||
|
Titolo.Style = {HAlign('center'),Bold(1), FontSize('32pt'),OuterMargin('0in','0in','3in','0in')};
|
||||||
|
tp_ENG.Title = (Titolo);
|
||||||
|
sottotitolo = Paragraph(NomeSito);
|
||||||
|
sottotitolo.Style = {HAlign('center'),Bold(1), FontSize('32pt'),OuterMargin('0in','0in','0in','0.2in')};
|
||||||
|
tp_ENG.Subtitle = sottotitolo;
|
||||||
|
report = Paragraph('Automatic report - Alpha test version');
|
||||||
|
report.Style = {FontSize('12pt'),Bold(1),HAlign('center'),OuterMargin('0in','0in','0.4in','0.2in')};
|
||||||
|
tp_ENG.Author = report;
|
||||||
|
datapub = Paragraph(datestr(today,'dd-mm-yyyy'));
|
||||||
|
datapub.Style = {FontSize('12pt'),HAlign('center')};
|
||||||
|
tp_ENG.PubDate = datapub;
|
||||||
|
add(rpt_ENG,tp_ENG);
|
||||||
|
end
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Title page created';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
%% Pagina sommario
|
||||||
|
% Add a default table of contents object to the report
|
||||||
|
template(rpt);
|
||||||
|
TOC = TableOfContents();
|
||||||
|
TOC.Layout.PageNumberFormat = 'I';
|
||||||
|
add(rpt,TOC);
|
||||||
|
if activeEN == 1
|
||||||
|
template(rpt_ENG);
|
||||||
|
TOC_ENG = TableOfContents();
|
||||||
|
TOC_ENG.Layout.PageNumberFormat = 'I';
|
||||||
|
add(rpt_ENG,TOC_ENG);
|
||||||
|
end
|
||||||
|
text = 'Summary page created';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
%% Disclaimer iniziale
|
||||||
|
disclaimer = Chapter;
|
||||||
|
dis = Heading1('Disclaimer');
|
||||||
|
dis.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
disclaimer.Title = dis;
|
||||||
|
text = Paragraph(['Il presente report ' char(232) ' un documento generato automaticamente '...
|
||||||
|
'dal software proprietario sviluppato da ASE S.r.l. Il suo obiettivo ' char(232) ' quello '...
|
||||||
|
'di riassumere i principali risultati ottenuti dalla strumentazione installata '...
|
||||||
|
'in un determinato sito del cliente, nel corso di un periodo temporale di riferimento. '...
|
||||||
|
'Il report riporta le principali informazioni relative al sito monitorato: queste includono '...
|
||||||
|
'numero e tipologia degli Array presenti, data di installazione, data di riferimento '...
|
||||||
|
'per i calcoli successivi, principali caratteristiche dei sensori utilizzati, etc. ']);
|
||||||
|
text2 = Paragraph(['Il report viene creato automaticamente il primo giorno di ogni mese e '...
|
||||||
|
'contiene i dati di monitoraggio elaborati a partire dal mese precedente (o dal mese '...
|
||||||
|
'della redazione dell''ultimo report, nel caso di Array inattivo), fornendo una panoramica generale '...
|
||||||
|
'del livello di attivit' char(224) ' del sito durante il periodo temporale di riferimento. '...
|
||||||
|
'Inoltre, nel caso in cui gli strumenti lo consentano, sono riportati grafici che '...
|
||||||
|
'integrano i dati raccolti da diverse tipologie di sensori, con l''obiettivo di '...
|
||||||
|
'evidenziare eventuali correlazioni tra le grandezze monitorate.']);
|
||||||
|
Link = Paragraph(ExternalLink('https://www2.aseltd.eu','cliccando qui.'));
|
||||||
|
text3 = Paragraph(['Si vuole sottolineare che questo documento ' char(232) ' generato completamente in automatico '...
|
||||||
|
'e non contiene pertanto alcuna valutazione o validazione di carattere tecnico '...
|
||||||
|
'relativamente ai risultati ottenuti dalla strumentazione installata. '...
|
||||||
|
'Si ricorda inoltre che quanto riportato nel report ' char(232) ' inteso come un riassunto dei risultati '...
|
||||||
|
'dell''attivit' char(224) ' di monitoraggio. Per la consultazione completa di tutti i dati '...
|
||||||
|
'relativi al sito in esame, ' char(232) ' possibile accedere con le proprie credenziali '...
|
||||||
|
'alla piattaforma interattiva web-based']);
|
||||||
|
text4 = Paragraph('ASE - Advanced Slope Engineering S.r.l.');
|
||||||
|
text5 = Paragraph('Via Robert Koch 53/A, 43123 Fraz. Pilastrello, Parma - Italy');
|
||||||
|
text6 = Paragraph('Tel: +39 0521 1404292');
|
||||||
|
text7 = Paragraph('REA n. 258983 - Cod Fis. e P.IVA 02687890349');
|
||||||
|
text8 = Paragraph('info@aseltd.eu - www.aseltd.eu');
|
||||||
|
text.HAlign = 'justify';
|
||||||
|
text2.HAlign = 'justify';
|
||||||
|
text3.HAlign = 'justify';
|
||||||
|
text4.Style = {Bold(1),HAlign('left')};
|
||||||
|
text5.Style = {HAlign('left'),OuterMargin('0in','0in','0in','0in'),FontSize('8pt')};
|
||||||
|
text6.Style = {HAlign('left'),OuterMargin('0in','0in','0in','0in'),FontSize('8pt')};
|
||||||
|
text7.Style = {HAlign('left'),OuterMargin('0in','0in','0in','0in'),FontSize('8pt')};
|
||||||
|
text8.Style = {HAlign('left'),OuterMargin('0in','0in','0in','0in'),FontSize('8pt')};
|
||||||
|
|
||||||
|
logo = Image('aselogo.jpeg');
|
||||||
|
logo.Style = {Height('9cm'),HAlign('left')};
|
||||||
|
|
||||||
|
add(disclaimer,text);
|
||||||
|
add(disclaimer,text2);
|
||||||
|
add(disclaimer,text3);
|
||||||
|
Link.Style = {OuterMargin('0in','0in','0in','0in')};
|
||||||
|
add(disclaimer,Link);
|
||||||
|
add(disclaimer,logo);
|
||||||
|
add(disclaimer,text4);
|
||||||
|
add(disclaimer,text5);
|
||||||
|
add(disclaimer,text6);
|
||||||
|
add(disclaimer,text7);
|
||||||
|
add(disclaimer,text8);
|
||||||
|
br = PageBreak();
|
||||||
|
add(disclaimer,br);
|
||||||
|
add(rpt,disclaimer);
|
||||||
|
|
||||||
|
if activeEN == 1
|
||||||
|
disclaimer_ENG = Chapter;
|
||||||
|
dis_ENG = Heading1('Disclaimer');
|
||||||
|
dis_ENG.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
disclaimer_ENG.Title = dis_ENG;
|
||||||
|
% Disclaimer ENG
|
||||||
|
text = Paragraph(['This report consists of a document automatically generated by ASE proprietary software. Its objective is '...
|
||||||
|
'to summarize the main monitoring results recorded during a specific time interval by the instrumentation installed on-site. Moreover, '...
|
||||||
|
'this document presents all the key information concerning the monitored site, including Arrays number and typology, installation date, '...
|
||||||
|
'reference date, installed sensors features, etc. The report is generated automatically on the first day of each month, and it contains '...
|
||||||
|
'monitoring data elaborated from the beginning of the previous month, in order to provide a general overview of the site activity '...
|
||||||
|
'during the reference time period. For specific typologies of sensors, the report also includes graphs composed of different physical quantities, '...
|
||||||
|
'in order to highlight any correlation between data sampled by these sensors.']);
|
||||||
|
Link = Paragraph(ExternalLink('https://www2.aseltd.eu','this link.'));
|
||||||
|
text2 = Paragraph(['We would like to remind that the report generation is completely automated, therefore it does not contain '...
|
||||||
|
'any technical evaluation or validation concerning the results obtained by the instrumentation installed on-site. '...
|
||||||
|
'Moreover, the report is intended as a resume of the main outcomes resulting from the monitoring activity. The user can access complete datasets '...
|
||||||
|
'and information concerning the monitored site by logging into the interactive web-based platform developed by ASE S.r.l., available at']);
|
||||||
|
text7 = Paragraph('REA n. 258983 - VAT ID 02687890349');
|
||||||
|
text.HAlign = 'justify';
|
||||||
|
text2.HAlign = 'justify';
|
||||||
|
text7.Style = {HAlign('left'),OuterMargin('0in','0in','0in','0in'),FontSize('8pt')};
|
||||||
|
|
||||||
|
add(disclaimer_ENG,text);
|
||||||
|
add(disclaimer_ENG,text2);
|
||||||
|
Link.Style = {OuterMargin('0in','0in','0in','0in')};
|
||||||
|
add(disclaimer_ENG,Link);
|
||||||
|
add(disclaimer_ENG,logo);
|
||||||
|
add(disclaimer_ENG,text4);
|
||||||
|
add(disclaimer_ENG,text5);
|
||||||
|
add(disclaimer_ENG,text6);
|
||||||
|
add(disclaimer_ENG,text7);
|
||||||
|
add(disclaimer_ENG,text8);
|
||||||
|
br = PageBreak();
|
||||||
|
add(disclaimer_ENG,br);
|
||||||
|
add(rpt_ENG,disclaimer_ENG);
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'Disclaimer page created';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
|
||||||
|
%% Capitolo 1 - sistema MUMS
|
||||||
|
sys = Chapter;
|
||||||
|
app = Heading1('Sistema MUMS');
|
||||||
|
app.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
sys.Title = app;
|
||||||
|
testo = Paragraph(['Il monitoraggio ' char(232) ' svolto mediante sistema MUMS '...
|
||||||
|
'(Modular Underground Monitoring System), progettato per il controllo multiparametrico dei movimenti '...
|
||||||
|
'orizzontali o verticali del terreno, delle deformazioni di strutture civili '...
|
||||||
|
'e/o geotecniche, di barriere paramassi o debris flow. In ogni nodo possono essere collocati sensori per monitorare '...
|
||||||
|
'grandezze fisiche di varia natura come spostamenti, inclinazioni, pressione interstiziale, temperatura, etc.']);
|
||||||
|
testo2 = Paragraph(['In particolare, il sito ' char(232) ' caratterizzato dalla presenza di ' arraysito ' e relativo sistema'...
|
||||||
|
' di acquisizione automatico, completato da batteria tampone ed adeguato sistema di ricarica.']);
|
||||||
|
if controlsito ~= 0
|
||||||
|
[rTA,~] = size(tipoalarms);
|
||||||
|
aVMS = 0;
|
||||||
|
aCAM = 0;
|
||||||
|
aAL = 0;
|
||||||
|
aTL = 0;
|
||||||
|
for mm = 1:rTA
|
||||||
|
if strcmp(char(tipoalarms(mm)),'Variable Message System')
|
||||||
|
aVMS = 1;
|
||||||
|
elseif strcmp(char(tipoalarms(mm)),'Traffic Lights')
|
||||||
|
aCAM = 1;
|
||||||
|
elseif strcmp(char(tipoalarms(mm)),'Alarms')
|
||||||
|
aAL = 1;
|
||||||
|
elseif strcmp(char(tipoalarms(mm)),'Camera')
|
||||||
|
aCAM = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
testo2prep = [];
|
||||||
|
spazio = '';
|
||||||
|
if aAL > 0
|
||||||
|
if nAL == 1
|
||||||
|
testo2prep = [num2str(nAL) ' allarme acustico-visivo'];
|
||||||
|
else
|
||||||
|
testo2prep = [num2str(nAL) ' allarmi acustico-visivi'];
|
||||||
|
end
|
||||||
|
spazio = ', ';
|
||||||
|
end
|
||||||
|
if aTL > 0
|
||||||
|
if nTL == 1
|
||||||
|
testo2prep = [testo2prep spazio num2str(nTL) ' impianto semaforico'];
|
||||||
|
else
|
||||||
|
testo2prep = [testo2prep spazio num2str(nTL) ' impianti semaforici'];
|
||||||
|
end
|
||||||
|
spazio = ', ';
|
||||||
|
end
|
||||||
|
if aVMS > 0
|
||||||
|
if nVMS == 1
|
||||||
|
testo2prep = [testo2prep spazio num2str(nVMS) ' pannello a messaggio variabile'];
|
||||||
|
else
|
||||||
|
testo2prep = [testo2prep spazio num2str(nVMS) ' pannelli a messaggio variabile'];
|
||||||
|
end
|
||||||
|
spazio = ', ';
|
||||||
|
end
|
||||||
|
if aCAM > 0
|
||||||
|
if nCAM == 1
|
||||||
|
testo2prep = [testo2prep spazio num2str(nCAM) ' videocamera'];
|
||||||
|
else
|
||||||
|
testo2prep = [testo2prep spazio num2str(nCAM) ' videocamere'];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
testo2bis = Paragraph(['Il sistema inoltre include un dispositivo di allertamento composto da ' testo2prep '.']);
|
||||||
|
else
|
||||||
|
testo2bis = [];
|
||||||
|
end
|
||||||
|
testo3 = Paragraph(['I dati grezzi (punti elettrici) sono salvati su apposito supporto' ...
|
||||||
|
' di memoria locale (scheda SD) ed inviati al centro di elaborazione secondo la frequenza impostata. '...
|
||||||
|
'Una volta ricevute le informazioni, il dato viene salvato su un Database con backup giornaliero automatico, '...
|
||||||
|
'elaborato mediante software con algoritmi proprietari e reso disponibile su piattaforma web ad accesso '...
|
||||||
|
'controllato in pochi secondi.']);
|
||||||
|
testo4 = Paragraph(['Il funzionamento completo del sisema MUMS ' char(232) ' schematizzato nella figura seguente.']);
|
||||||
|
ionh = Image(('ionh.png'));
|
||||||
|
testo.HAlign = 'justify';
|
||||||
|
testo2.HAlign = 'justify';
|
||||||
|
testo3.HAlign = 'justify';
|
||||||
|
testo4.HAlign = 'justify';
|
||||||
|
testo.HAlign = 'justify';
|
||||||
|
testo2.HAlign = 'justify';
|
||||||
|
testo3.HAlign = 'justify';
|
||||||
|
testo4.HAlign = 'justify';
|
||||||
|
ionhcaption = Paragraph(['Fig. ' num2str(FIG) ' - Struttura del sistema di monitoraggio']);
|
||||||
|
FIG = FIG + 1;
|
||||||
|
ionhcaption.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
ionh.Style = {Height('8cm'),HAlign('center')};
|
||||||
|
add(sys,testo);
|
||||||
|
add(sys,testo2);
|
||||||
|
if controlsito ~= 0
|
||||||
|
add(sys,testo2bis);
|
||||||
|
end
|
||||||
|
add(sys,testo3);
|
||||||
|
add(sys,testo4);
|
||||||
|
add(sys,ionh);
|
||||||
|
add(sys,ionhcaption);
|
||||||
|
add(rpt,sys);
|
||||||
|
template(rpt);
|
||||||
|
|
||||||
|
if activeEN == 1
|
||||||
|
sys_ENG = Chapter;
|
||||||
|
app_ENG = Heading1('MUMS System');
|
||||||
|
app_ENG.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
sys_ENG.Title = app_ENG;
|
||||||
|
testo = Paragraph(['The monitoring activity is performed with MUMS '...
|
||||||
|
'(Modular Underground Monitoring System) technology, specifically developed for the '...
|
||||||
|
'multi-parametric monitoring of slopes, civil and/or geotechnical structures, rockfall and '...
|
||||||
|
'debris flow barriers. Each node of the Array can equip sensors able to measure different '...
|
||||||
|
'physical quantities like displacements, tilts, pressure, temperatures, etc.']);
|
||||||
|
testo2 = Paragraph(['In particular, the monitoring system installed on-site includes ' arraysitoENG...
|
||||||
|
', the automatic data acquisition '...
|
||||||
|
'system and a battery, with dedicated recharge apparatus.']);
|
||||||
|
if controlsito ~= 0
|
||||||
|
testo2prep = [];
|
||||||
|
spazio = '';
|
||||||
|
if aAL > 0
|
||||||
|
if aAL == 1
|
||||||
|
testo2prep = [num2str(nAL) ' visual-acoustic alarm'];
|
||||||
|
else
|
||||||
|
testo2prep = [num2str(nAL) ' visual-acoustic alarms'];
|
||||||
|
end
|
||||||
|
spazio = ', ';
|
||||||
|
end
|
||||||
|
if aTL > 0
|
||||||
|
if aTL == 1
|
||||||
|
testo2prep = [testo2prep spazio num2str(nTL) ' traffic light'];
|
||||||
|
else
|
||||||
|
testo2prep = [testo2prep spazio num2str(nTL) ' traffic lights'];
|
||||||
|
end
|
||||||
|
spazio = ', ';
|
||||||
|
end
|
||||||
|
if aVMS > 0
|
||||||
|
if aVMS == 1
|
||||||
|
testo2prep = [testo2prep spazio num2str(nVMS) ' variable message panel (VMP)'];
|
||||||
|
else
|
||||||
|
testo2prep = [testo2prep spazio num2str(nVMS) ' variable message panels (VMPs)'];
|
||||||
|
end
|
||||||
|
spazio = ', ';
|
||||||
|
end
|
||||||
|
if aCAM > 0
|
||||||
|
if aCAM == 1
|
||||||
|
testo2prep = [testo2prep spazio num2str(nCAM) ' camera'];
|
||||||
|
else
|
||||||
|
testo2prep = [testo2prep spazio num2str(nCAM) ' cameras'];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
testo2bis = Paragraph(['Moreover, the following devices are included for early warning purposes: ' testo2prep '.']);
|
||||||
|
end
|
||||||
|
testo3 = Paragraph(['The datalogger saves raw data (electrical signals) on a volatile memory (SD card) and then transmits them '...
|
||||||
|
'to the elaboration centre, according to a predefined frequency. Upon arrival on central server, a proprietary '...
|
||||||
|
'software routine automatically elaborates raw data and converts them into physical units. '...
|
||||||
|
'Results are stored in a "parallel" database from which they can be accessed and analysed '...
|
||||||
|
'thanks to a dedicated web-based platform with private access.']);
|
||||||
|
testo4 = Paragraph('The following image describes the structure of the MUMS-based system.');
|
||||||
|
testo.HAlign = 'justify';
|
||||||
|
testo2.HAlign = 'justify';
|
||||||
|
testo3.HAlign = 'justify';
|
||||||
|
testo4.HAlign = 'justify';
|
||||||
|
ionhcaption = Paragraph(['Fig. ' num2str(FIG_ENG) ' - Structure of the monitoring system']);
|
||||||
|
FIG_ENG = FIG_ENG + 1;
|
||||||
|
ionhcaption.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
ionh.Style = {Height('9cm'),HAlign('center')};
|
||||||
|
add(sys_ENG,testo);
|
||||||
|
add(sys_ENG,testo2);
|
||||||
|
if controlsito ~= 0
|
||||||
|
add(sys_ENG,testo2bis);
|
||||||
|
end
|
||||||
|
add(sys_ENG,testo3);
|
||||||
|
add(sys_ENG,testo4);
|
||||||
|
add(sys_ENG,ionh);
|
||||||
|
add(sys_ENG,ionhcaption);
|
||||||
|
add(rpt_ENG,sys_ENG);
|
||||||
|
template(rpt_ENG);
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'MUMS system defined';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
%% Capitolo 2 - Geografia e composizione
|
||||||
|
geoloc = Chapter;
|
||||||
|
app = Heading1('Caratteristiche del sito');
|
||||||
|
app.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
geoloc.Title = app;
|
||||||
|
|
||||||
|
testo = Paragraph(['Le principali caratteristiche della strumentazione installata nel sito '...
|
||||||
|
'in esame sono riportate nella seguente tabella. Le figure sottostanti presentano la localizzazione '...
|
||||||
|
'geografica degli Array e del relativo sistema di acquisizione (immagini '...
|
||||||
|
'tratte da Mappe di Bing).']);
|
||||||
|
|
||||||
|
comando = ['select lat, lon from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Coordinate = (cell2mat(curs.Data))';
|
||||||
|
latNS = 'N';
|
||||||
|
lonEO = 'E';
|
||||||
|
if Coordinate(1) < 0
|
||||||
|
latNS = 'S';
|
||||||
|
end
|
||||||
|
if Coordinate(2) < 0
|
||||||
|
lonEO = 'O';
|
||||||
|
end
|
||||||
|
testo.HAlign = 'justify';
|
||||||
|
|
||||||
|
testo2 = Paragraph(['In particolare, il sito in esame si trova '...
|
||||||
|
'alle seguenti coordinate geografiche: Latitudine ' num2str(abs(Coordinate(1))) ...
|
||||||
|
' ' latNS ', Longitudine ' num2str(abs(Coordinate(2,:))) ' ' lonEO '.']);
|
||||||
|
testo2.HAlign = 'justify';
|
||||||
|
|
||||||
|
%--- IMMAGINI GEOGRAFICHE ---%
|
||||||
|
mapsito = ['sito' siteID '.png'];
|
||||||
|
geo = Image((mapsito));
|
||||||
|
geo.Style = [geo.Style {ScaleToFit}];
|
||||||
|
geo_cap = Paragraph(['Fig. ' num2str(FIG) ' - Localizzazione geografica della strumentazione installata e del sistema di acquisizione dati']);
|
||||||
|
FIG = FIG+1;
|
||||||
|
geo_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
mapcatene = ['sito' siteID 'det.png'];
|
||||||
|
sito = Image((mapcatene));
|
||||||
|
sito.Style = [sito.Style {ScaleToFit}];
|
||||||
|
sito_cap = Paragraph(['Fig. ' num2str(FIG) ' - Posizione in sito delle centraline e degli strumenti installati']);
|
||||||
|
FIG = FIG+1;
|
||||||
|
sito_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
|
||||||
|
%--- TABELLA SITO MONITORATO ---%
|
||||||
|
[status,firstdata_num,datasample,colonna1,colonna2,colonna2bis,colonna3,...
|
||||||
|
colonna4,colonna5,colonna6,colonna6_short,colonna7,yesKLHR3D,c1trigger,c6trigger,cA] = ...
|
||||||
|
report_table(info_sito,controlsito,tipoarray,tipoalarms,alarms,chainID,Chain_Scheme,...
|
||||||
|
yesTL,yesTLHR,yesTLH,yesTLHRH,yesPL,yesBL,yesLL,yesRL,yesKL,yesKLHR,yesThL,...
|
||||||
|
yesPT100,yesIPL,yesIPLHR,yesTuL,yesRaL,yesPCL,yesPCLHR,yesPrL,yesEL,yes3DEL,...
|
||||||
|
yesWEL,yesMPBEL,yesCrL,yes3DCrL,yesBML,yesHL,yesLuxL,yesCO2,yesRSN,yesRSNHR,yesTrL,...
|
||||||
|
yesPE,yesWL,yes2DCrL,yesGF,yesGS,rTL,rTLHR,rTLH,rTLHRH,rKL,rKLHR,rIPL,rIPLHR,nCT,...
|
||||||
|
num_nodi,time,conn,FileName) ;
|
||||||
|
|
||||||
|
% Controllo che Colonna 5 (lunghezza Array) abbia dei dati,
|
||||||
|
% altrimenti la elimino
|
||||||
|
[rC5,~] = size(colonna5);
|
||||||
|
C5 = 0;
|
||||||
|
for c = 2:rC5
|
||||||
|
if strcmp(char(colonna5(c)),'-') == 0 % Esiste almeno un valore di lunghezza
|
||||||
|
C5 = 1;
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if C5 == 1
|
||||||
|
tab = FormalTable([colonna1,colonna2,colonna2bis,colonna3,colonna4,colonna5,colonna6_short,colonna7]);
|
||||||
|
else
|
||||||
|
tab = FormalTable([colonna1,colonna2,colonna2bis,colonna3,colonna4,colonna6,colonna7]);
|
||||||
|
end
|
||||||
|
|
||||||
|
% formattazione tabella
|
||||||
|
tab.TableEntriesStyle = {HAlign('center'),VAlign('middle'),FontSize(Font_table),InnerMargin('0.5mm')};
|
||||||
|
tab.Style = {ResizeToFitContents(true),Width("100%"),RowSep('solid','black','1px'),...
|
||||||
|
ColSep('solid','black','1px'),Hyphenation(false),BackgroundColor('#E0F1FF')};
|
||||||
|
tab.Border = 'single';
|
||||||
|
tabCaption = Paragraph('Tab. 1 - Tipologia e caratteristiche della strumentazione installata in sito');
|
||||||
|
tabCaption.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
bodyFirstRow = tab.Body.Children(1);
|
||||||
|
bodyFirstRow.Style = [bodyFirstRow.Style {Bold()}];
|
||||||
|
if C5 == 0
|
||||||
|
grps(1) = TableColSpecGroup;
|
||||||
|
grps(1).Span = 7;
|
||||||
|
specs(1) = TableColSpec;
|
||||||
|
specs(1).Span = 1;
|
||||||
|
specs(1).Style = {Width("7.5%")};
|
||||||
|
specs(2) = TableColSpec;
|
||||||
|
specs(2).Span = 3;
|
||||||
|
specs(2).Style = {Width("15%")};
|
||||||
|
specs(3) = TableColSpec;
|
||||||
|
specs(3).Span = 1;
|
||||||
|
specs(3).Style = {Width("10%")};
|
||||||
|
specs(4) = TableColSpec;
|
||||||
|
specs(4).Span = 1;
|
||||||
|
specs(5) = TableColSpec;
|
||||||
|
specs(5).Span = 1;
|
||||||
|
specs(5).Style = {Width("12%")};
|
||||||
|
grps(1).ColSpecs = specs;
|
||||||
|
tab.ColSpecGroups = grps;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Installazione
|
||||||
|
testo3 = Paragraph(['La prima lettura disponibile, riportata in Tab. 1, si riferisce '...
|
||||||
|
'alla data di inizio monitoraggio. Va sottolineato come i primissimi dati '...
|
||||||
|
'rilevati da uno strumento possano essere influenzati dagli assestamenti occorsi in '...
|
||||||
|
'seguito all''installazione o dall''adattamento del sensore in sito. Per questo motivo '...
|
||||||
|
'viene definita la lettura di riferimento come data in cui i dati raccolti non mostrano '...
|
||||||
|
'pi' char(249) ' i caratteri tipici dell''adattamento strumentale in sito (per maggiori informazioni '...
|
||||||
|
'consigliamo di fare riferimento agli standard ISO 18674-1:2015).']);
|
||||||
|
testo3.HAlign = 'justify';
|
||||||
|
|
||||||
|
add(geoloc,testo);
|
||||||
|
add(geoloc,testo2);
|
||||||
|
add(geoloc,testo3);
|
||||||
|
add(geoloc,tabCaption);
|
||||||
|
add(geoloc,tab);
|
||||||
|
add(geoloc,br);
|
||||||
|
add(geoloc,geo);
|
||||||
|
add(geoloc,geo_cap);
|
||||||
|
add(geoloc,sito);
|
||||||
|
add(geoloc,sito_cap);
|
||||||
|
add(rpt,geoloc);
|
||||||
|
template(rpt);
|
||||||
|
|
||||||
|
if activeEN == 1
|
||||||
|
geoloc_ENG = Chapter;
|
||||||
|
app_ENG = Heading1('Site features');
|
||||||
|
app_ENG.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
geoloc_ENG.Title = app_ENG;
|
||||||
|
|
||||||
|
testo = Paragraph(['The table reported below summarizes the main characteristics of the instrumentation installed on-site. '...
|
||||||
|
'Moreover, following images display the geographical position of the monitoring system, including the location of Arrays '...
|
||||||
|
'and acquisition devices (source: Bing Maps).']);
|
||||||
|
|
||||||
|
if Coordinate(2) < 0
|
||||||
|
lonEO = 'W';
|
||||||
|
end
|
||||||
|
testo.HAlign = 'justify';
|
||||||
|
|
||||||
|
testo2 = Paragraph(['Geographical coordinates of the monitored site are: '...
|
||||||
|
'Latitude ' num2str(abs(Coordinate(1))) ...
|
||||||
|
' ' latNS ', Longitude ' num2str(abs(Coordinate(2,:))) ' ' lonEO '.']);
|
||||||
|
testo2.HAlign = 'justify';
|
||||||
|
|
||||||
|
%--- IMMAGINI GEOGRAFICHE ---%
|
||||||
|
geo_cap = Paragraph(['Fig. ' num2str(FIG_ENG) ' - Geographical position of the monitored site']);
|
||||||
|
FIG_ENG = FIG_ENG+1;
|
||||||
|
geo_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
sito_cap = Paragraph(['Fig. ' num2str(FIG_ENG) ' - On-site location of monitoring devices']);
|
||||||
|
FIG_ENG = FIG_ENG+1;
|
||||||
|
sito_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
|
||||||
|
%--- TABELLA SITO MONITORATO ---%
|
||||||
|
[status,firstdata_num,datasample,colonna1,colonna2,colonna2bis,colonna3,...
|
||||||
|
colonna4,colonna5,colonna6,colonna6_short,colonna7,yesKLHR3D,c1trigger,c6trigger,cA]...
|
||||||
|
= report_table_ENG(info_sito,controlsito,tipoarray,tipoalarms,alarms,chainID,Chain_Scheme,...
|
||||||
|
yesTL,yesTLHR,yesTLH,yesTLHRH,yesPL,yesBL,yesLL,yesRL,yesKL,yesKLHR,yesThL,...
|
||||||
|
yesPT100,yesIPL,yesIPLHR,yesTuL,yesRaL,yesPCL,yesPCLHR,yesPrL,yesEL,yes3DEL,...
|
||||||
|
yesWEL,yesMPBEL,yesCrL,yes3DCrL,yesBML,yesHL,yesLuxL,yesCO2,yesRSN,yesRSNHR,yesTrL,...
|
||||||
|
yesPE,yesWL,yes2DCrL,yesGF,yesGS,rTL,rTLHR,rTLH,rTLHRH,rKL,rKLHR,rIPL,rIPLHR,nCT,...
|
||||||
|
num_nodi,time,conn,FileName);
|
||||||
|
|
||||||
|
% Controllo che Colonna 5 (lunghezza Array) abbia dei dati,
|
||||||
|
% altrimenti la elimino
|
||||||
|
[rC5,~] = size(colonna5);
|
||||||
|
C5 = 0;
|
||||||
|
for c = 2:rC5
|
||||||
|
if strcmp(char(colonna5(c)),'-') == 0 % Esiste almeno un valore di lunghezza
|
||||||
|
C5 = 1;
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if C5 == 1
|
||||||
|
tab = FormalTable([colonna1,colonna2,colonna2bis,colonna3,colonna4,colonna5,colonna6_short,colonna7]);
|
||||||
|
else
|
||||||
|
tab = FormalTable([colonna1,colonna2,colonna2bis,colonna3,colonna4,colonna6,colonna7]);
|
||||||
|
end
|
||||||
|
|
||||||
|
% formattazione tabella
|
||||||
|
tab.TableEntriesStyle = {HAlign('center'),VAlign('middle'),FontSize(Font_table),InnerMargin('0.5mm')};
|
||||||
|
tab.Style = {ResizeToFitContents(true),Width("100%"),RowSep('solid','black','1px'),...
|
||||||
|
ColSep('solid','black','1px'),Hyphenation(false),BackgroundColor('#E0F1FF')};
|
||||||
|
tab.Border = 'single';
|
||||||
|
tabCaption = Paragraph('Tab. 1 - Instrumentation typologies and features');
|
||||||
|
tabCaption.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
|
||||||
|
bodyFirstRow = tab.Body.Children(1);
|
||||||
|
bodyFirstRow.Style = [bodyFirstRow.Style {Bold()}];
|
||||||
|
if C5 == 0
|
||||||
|
grps(1) = TableColSpecGroup;
|
||||||
|
grps(1).Span = 7;
|
||||||
|
specs(1) = TableColSpec;
|
||||||
|
specs(1).Span = 1;
|
||||||
|
specs(1).Style = {Width("7.5%")};
|
||||||
|
specs(2) = TableColSpec;
|
||||||
|
specs(2).Span = 3;
|
||||||
|
specs(2).Style = {Width("15%")};
|
||||||
|
specs(3) = TableColSpec;
|
||||||
|
specs(3).Span = 1;
|
||||||
|
specs(3).Style = {Width("10%")};
|
||||||
|
specs(4) = TableColSpec;
|
||||||
|
specs(4).Span = 1;
|
||||||
|
specs(5) = TableColSpec;
|
||||||
|
specs(5).Span = 1;
|
||||||
|
specs(5).Style = {Width("12%")};
|
||||||
|
grps(1).ColSpecs = specs;
|
||||||
|
tab.ColSpecGroups = grps;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Installazione
|
||||||
|
testo3 = Paragraph(['The first available reading date, reported in Tab. 1, '...
|
||||||
|
'refers to the beginning of the monitoring activity. '...
|
||||||
|
'It should be taken into account that the very first monitoring data '...
|
||||||
|
'are usually influenced by stabilization phenomena, which are a '...
|
||||||
|
'natural consequence of the tool installation on-site. For this reason, '...
|
||||||
|
'a reference reading date is defined, representing a time reference '...
|
||||||
|
'where the device can be considered fully operational since no more '...
|
||||||
|
'stabilization movements are observed from sampled data '...
|
||||||
|
'(we suggest to refer to the International Standard EN ISO 18674-1:2015 '...
|
||||||
|
'documentation for further information on this matter).']);
|
||||||
|
testo3.HAlign = 'justify';
|
||||||
|
|
||||||
|
add(geoloc_ENG,testo);
|
||||||
|
add(geoloc_ENG,testo2);
|
||||||
|
add(geoloc_ENG,testo3);
|
||||||
|
add(geoloc_ENG,tabCaption);
|
||||||
|
add(geoloc_ENG,tab);
|
||||||
|
add(geoloc_ENG,br);
|
||||||
|
add(geoloc_ENG,geo);
|
||||||
|
add(geoloc_ENG,geo_cap);
|
||||||
|
add(geoloc_ENG,sito);
|
||||||
|
add(geoloc_ENG,sito_cap);
|
||||||
|
add(rpt_ENG,geoloc_ENG);
|
||||||
|
template(rpt_ENG);
|
||||||
|
end
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Site information defined';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
%% Capitolo 3 - Centraline
|
||||||
|
% --- Analisi centraline e catene ---
|
||||||
|
|
||||||
|
datalogger = Chapter;
|
||||||
|
app = Heading1('Risultati - Dati delle centraline');
|
||||||
|
app.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
datalogger.Title = app;
|
||||||
|
|
||||||
|
datalogger_ENG = Chapter;
|
||||||
|
if activeEN == 1
|
||||||
|
app_ENG = Heading1('Results - Control units');
|
||||||
|
app_ENG.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
datalogger_ENG.Title = app_ENG;
|
||||||
|
end
|
||||||
|
|
||||||
|
[FIG,FIG_ENG,datarif,contunit,IDscaduta] = report_CU(unitID,chainID,adesso,datainvio,numgiorni,...
|
||||||
|
datasample,tipoarray,firstdata_num,siteID,datalogger,datalogger_ENG,FIG,FIG_ENG,rpt,rpt_ENG,...
|
||||||
|
Font_caption,Font_section,activeEN,conn,FileName);
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Control units information defined';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
%% Capitolo 4 - Catene
|
||||||
|
|
||||||
|
MUMS = Chapter;
|
||||||
|
app = Heading1('Risultati - Dati della strumentazione installata');
|
||||||
|
app.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter)};
|
||||||
|
MUMS.Title = app;
|
||||||
|
|
||||||
|
if activeEN == 1
|
||||||
|
MUMS_ENG = Chapter;
|
||||||
|
app_ENG = Heading1('Results - Monitoring tools');
|
||||||
|
app_ENG.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter)};
|
||||||
|
MUMS_ENG.Title = app_ENG;
|
||||||
|
else
|
||||||
|
MUMS_ENG = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
[PL_A,PL_D,FIG,FIG_ENG] = report_AR(chainID,unitID,tipoarray,contunit,...
|
||||||
|
siteID,FIG,FIG_ENG,rpt,rpt_ENG,Font_caption,Font_Chapter,Font_section,...
|
||||||
|
Font_tools,datarif,yesKLHR3D,rTL,rTLHR,rTLH,rTLHRH,rPL,rBL,rLL,rRL,rKL,...
|
||||||
|
rKLHR,rThL,rPT100,rIPL,rIPLHR,rTuL,rRaL,rPCL,rPCLHR,rPrL,rEL,r3DEL,rWEL,rMPBEL,...
|
||||||
|
rCrL,r2DCrL,r3DCrL,rBML,rHL,rLuxL,rCO2,rRSN,rRSNHR,rTrL,rPE,rWL,rGF,rGS,...
|
||||||
|
NodoTiltLink,NodoTiltLinkH,NodoPiezoLink,NodoBaroLink,NodoLoadLink,...
|
||||||
|
NodoRainLink,NodoKlinoLink,NodoKlinoLinkHR,NodoThermLink,NodoPT100Link,...
|
||||||
|
NodoInPlaceLink,NodoInPlaceLinkHR,NodoTunnelLink,NodoRadialLink,NodoPreConvLink,...
|
||||||
|
NodoPressureLink,NodoExtensometerLink,Nodo3DExtensometerLink,...
|
||||||
|
NodoWireExtensometerLink,NodoMultiPointExtensometerLink,NodoCrackLink,...
|
||||||
|
Nodo2DCrackLink,Nodo3DCrackLink,NodoBaroMusaLink,NodoHumidityLink,NodoLuxLink,...
|
||||||
|
NodoCO2Link,NodoRSNLink,NodoRSNHRLink,NodoTriggerLink,NodoStressMeter,NodoWeirLink,...
|
||||||
|
NodoPendulum,MUMS,MUMS_ENG,colonna2,colonna2bis,colonna4,firstdata_num,activeEN,IDscaduta,...
|
||||||
|
status,br,conn,FileName);
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Arrays information defined';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
%% Capitolo 5 - Control Tools
|
||||||
|
if cA > 1 % Significa che ci sono CT
|
||||||
|
CT = Chapter;
|
||||||
|
app = Heading1('Risultati - Attivazioni dei Control Tools');
|
||||||
|
app.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter)};
|
||||||
|
CT.Title = app;
|
||||||
|
|
||||||
|
if activeEN == 1
|
||||||
|
CT_ENG = Chapter;
|
||||||
|
app_ENG = Heading1('Results - Control Tools activations');
|
||||||
|
app_ENG.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter)};
|
||||||
|
CT_ENG.Title = app_ENG;
|
||||||
|
else
|
||||||
|
CT_ENG = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
[FIG,FIG_ENG] = report_CT(c1trigger,c6trigger,alarms,nCT,rpt,Font_caption,...
|
||||||
|
Font_table,Font_section,datarif,CT,CT_ENG,FIG,FIG_ENG,activeEN,conn,FileName);
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Control tools information defined';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Appendice
|
||||||
|
[dim,~]= size(colonna6);
|
||||||
|
appendice = Chapter;
|
||||||
|
app = Heading1('Appendice');
|
||||||
|
app.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
appendice.Title = app;
|
||||||
|
|
||||||
|
if activeEN == 1
|
||||||
|
appendice_ENG = Chapter;
|
||||||
|
app_ENG = Heading1('Appendix');
|
||||||
|
app_ENG.Style = {OuterMargin('0in','0in','0in','0in'),FontSize(Font_Chapter),HAlign('justify')};
|
||||||
|
appendice_ENG.Title = app_ENG;
|
||||||
|
else
|
||||||
|
appendice_ENG = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
report_appendix(yesTL,yesIPL,yesIPLHR,yesTLH,yesPCL,yesTLHR,yesTLHRH,yesPCLHR,...
|
||||||
|
yesPL,yesBL,yesTuL,yesRaL,yesThL,yesKL,yesKLHR,yesRL,yesLL,yesPrL,yesPT100,...
|
||||||
|
yesCrL,yes3DCrL,yesEL,yes3DEL,yesWEL,yesMPBEL,yesTrL,nCAM,yesWL,yesPE,PL_A,PL_D,...
|
||||||
|
Font_section,Font_caption,Font_tools,FIG,FIG_ENG,dim,appendice,appendice_ENG,...
|
||||||
|
colonna4,colonna6,rpt,rpt_ENG,activeEN,FileName);
|
||||||
|
|
||||||
|
% Chiudi report
|
||||||
|
close(rpt);
|
||||||
|
close(rpt_ENG);
|
||||||
|
|
||||||
|
%% ---Email---
|
||||||
|
[rU,cU] = size(Users_Report);
|
||||||
|
sendReportmail(NomeSito,Coordinate,meseadesso,NomeReport,NomeReport_ENG,...
|
||||||
|
Users_Report,recipients_ASE,Mail,Mail_ASE,activeEN,rU,cU,FileName);
|
||||||
|
end
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'Report Software ended correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
252
ATD/Report_ASE.m
Executable file
252
ATD/Report_ASE.m
Executable file
@@ -0,0 +1,252 @@
|
|||||||
|
function Report_ASE(IDcentralina,siteID,unitID,chainID,Chain_Scheme,num_nodi,...
|
||||||
|
alarms,Mail,Users_Report,activeEN,time,conn,FileName)
|
||||||
|
% Software per la generazione automatica di report sull'attività di
|
||||||
|
% monitoraggio ASE
|
||||||
|
|
||||||
|
try
|
||||||
|
diary on
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'report_ASE function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
RPT_ON = 0; % parametro che regola la creazione o meno del report
|
||||||
|
NomeFile = strcat('Report',siteID,'.txt');
|
||||||
|
meseadesso = str2double(datestr(today,'mm'));
|
||||||
|
if isfile(NomeFile) == 1 % Esiste
|
||||||
|
|
||||||
|
% Scarico la frequenza del report
|
||||||
|
comando = ['select freq_report from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Freq = cell2mat(curs.Data);
|
||||||
|
numgiorni = Freq;
|
||||||
|
|
||||||
|
Filetesto = importdata(NomeFile);
|
||||||
|
[rTXT,~] = size(Filetesto);
|
||||||
|
if rTXT > 1
|
||||||
|
datainvio = Filetesto(1,1); % mese di invio OPPURE data di ultimo invio
|
||||||
|
attivaReport = Filetesto(2,1);
|
||||||
|
else % file txt vuoto
|
||||||
|
if numgiorni == 30
|
||||||
|
datainvio = str2double(datestr(today,'mm'))+1; % mese successivo
|
||||||
|
else
|
||||||
|
datainvio = now;
|
||||||
|
end
|
||||||
|
attivaReport = 1; % report disattivato
|
||||||
|
end
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = ['Report frequency:' num2str(numgiorni) ' days'];
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
if numgiorni == 30
|
||||||
|
adesso = str2double(datestr(today,'mm'));
|
||||||
|
if datainvio == adesso
|
||||||
|
RPT_ON = 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
adesso = now;
|
||||||
|
if adesso >= datainvio + numgiorni
|
||||||
|
RPT_ON = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if RPT_ON == 1 && attivaReport == 0
|
||||||
|
try
|
||||||
|
attivaReport = 1;
|
||||||
|
outdat = fopen(NomeFile,'wt+');
|
||||||
|
fopen(NomeFile,'wt');
|
||||||
|
fmt = '%d \r';
|
||||||
|
fileID = fopen(NomeFile,'a');
|
||||||
|
fprintf(fileID,fmt,meseadesso);
|
||||||
|
fprintf(fileID,fmt,attivaReport);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
% salvo variabili da caricare in Report
|
||||||
|
nomevar = ['variabili_RPT' siteID '.mat'];
|
||||||
|
save(nomevar, 'unitID', 'chainID', 'alarms', 'Chain_Scheme', 'num_nodi', 'Users_Report', 'Mail', ...
|
||||||
|
'time', 'meseadesso', 'adesso', 'datainvio', 'numgiorni', 'activeEN', 'FileName');
|
||||||
|
|
||||||
|
rilancio = ['/usr/local/matlab_func/run_Report_lnx.sh /usr/local/MATLAB/MATLAB_Runtime/v93 '...
|
||||||
|
siteID ''];
|
||||||
|
|
||||||
|
status = system(rilancio);
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,status);
|
||||||
|
catch err
|
||||||
|
FileErr = ['ErrorFile-Report-' siteID '-' datestr(today) '-' datestr(now,'hhMMss')];
|
||||||
|
fid = fopen(FileErr,'a+');
|
||||||
|
fprintf(fid, '%s', err.getReport('extended','hyperlinks','off'));
|
||||||
|
fclose(fid);
|
||||||
|
|
||||||
|
%% Email
|
||||||
|
setpref('Internet','E_mail','alert@aseltd.eu');
|
||||||
|
setpref('Internet','SMTP_Server','smtps.aruba.it');
|
||||||
|
setpref('Internet','SMTP_Username','alert@aseltd.eu');
|
||||||
|
setpref('Internet','SMTP_Password','Ase#2013!20@bat');
|
||||||
|
props=java.lang.System.getProperties;
|
||||||
|
pp=props.setProperty('mail.smtp.auth','true'); %#ok
|
||||||
|
pp=props.setProperty('mail.smtp.socketFactory.class','javax.net.ssl.SSLSocketFactory'); %#ok
|
||||||
|
pp=props.setProperty('mail.smtp.socketFactory.port','465'); %#ok
|
||||||
|
|
||||||
|
% Uso il siteID per identificare il nome del sito
|
||||||
|
comando = ['select name from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
NomeSito = num2str(cell2mat(curs.Data));
|
||||||
|
|
||||||
|
subject_ITA = ('CRASH funzione Report');
|
||||||
|
testo = cellstr('Ciao Andrea e Alessandro,');
|
||||||
|
testobis = cellstr('');
|
||||||
|
testo2 = cellstr(['Il mostro biblico della funzione Report ha al proprio interno qualche minchiata '...
|
||||||
|
'per cui il SW crasha nel realizzare il report di ' NomeSito '. Vi prego di correggermi '...
|
||||||
|
'o continuer' char(243) ' a crashare e ad assillarvi con questa mail. BUAHAHAH! Troverete l''errore in allegato.']);
|
||||||
|
message_ITA = [testo; testobis; testo2];
|
||||||
|
message = cellstr('Tanti Blip e Blop a voi, ');
|
||||||
|
message2 = cellstr('Software ATD');
|
||||||
|
message_ITA = [message_ITA; message; message2];
|
||||||
|
|
||||||
|
recipients_ASE{1,1} = 'alessandro.valletta@aseltd.eu';
|
||||||
|
recipients_ASE{2,1} = 'andrea.carri@aseltd.eu';
|
||||||
|
|
||||||
|
allegato = FileErr;
|
||||||
|
|
||||||
|
sendmail(recipients_ASE, subject_ITA, message_ITA, allegato)
|
||||||
|
|
||||||
|
end
|
||||||
|
% Report(attivaReport,Mail,siteID,unitID,chainID,alarms,Chain_Scheme,...
|
||||||
|
% time,conn,num_nodi,meseadesso,adesso,datainvio,numgiorni,activeEN,Users_Report,...
|
||||||
|
% NomeFile,FileName);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
datainvio = meseadesso+1;
|
||||||
|
if datainvio > 12
|
||||||
|
datainvio = datainvio-12;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%% --- Modifica file di testo --- %%%
|
||||||
|
if numgiorni == 30
|
||||||
|
if datainvio == 12
|
||||||
|
nuovofile = 1;
|
||||||
|
elseif datainvio == 13
|
||||||
|
nuovofile = 13;
|
||||||
|
else
|
||||||
|
nuovofile = adesso+1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
nuovofile = datainvio + numgiorni;
|
||||||
|
end
|
||||||
|
attivaReport = 0;
|
||||||
|
outdat = fopen(NomeFile,'wt+');
|
||||||
|
fopen(NomeFile,'wt');
|
||||||
|
fmt = '%d \r';
|
||||||
|
fileID = fopen(NomeFile,'a');
|
||||||
|
fprintf(fileID,fmt,nuovofile);
|
||||||
|
fprintf(fileID,fmt,attivaReport);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
catch err
|
||||||
|
FileErr = ['ErrorFile-' IDcentralina '-' datestr(today) '-' datestr(now,'hhMMss') '.txt'];
|
||||||
|
fid = fopen(FileErr,'a+');
|
||||||
|
fprintf(fid, '%s', err.getReport('extended','hyperlinks','off'));
|
||||||
|
fclose(fid);
|
||||||
|
|
||||||
|
% Scarico la frequenza del report
|
||||||
|
comando = ['select freq_report from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Freq = cell2mat(curs.Data);
|
||||||
|
numgiorni = Freq;
|
||||||
|
meseadesso = str2double(datestr(today,'mm'));
|
||||||
|
|
||||||
|
NomeFile = strcat('Report',siteID,'.txt');
|
||||||
|
|
||||||
|
if isfile(NomeFile) == 1 % Esiste
|
||||||
|
Filetesto = importdata(NomeFile);
|
||||||
|
[rTXT,~] = size(Filetesto);
|
||||||
|
if rTXT >1
|
||||||
|
datainvio = Filetesto(1,1); % mese di invio OPPURE data di ultimo invio
|
||||||
|
else % file txt vuoto
|
||||||
|
if numgiorni == 30
|
||||||
|
datainvio = meseadesso;
|
||||||
|
else
|
||||||
|
datainvio = now;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
datainvio = meseadesso+1;
|
||||||
|
if datainvio > 12
|
||||||
|
datainvio = datainvio-12;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
attivaReport = 0;
|
||||||
|
outdat = fopen(NomeFile,'wt+');
|
||||||
|
fopen(NomeFile,'wt');
|
||||||
|
fmt = '%d \r';
|
||||||
|
fileID = fopen(NomeFile,'a');
|
||||||
|
if numgiorni == 30
|
||||||
|
if datainvio == 12
|
||||||
|
nuovofile = 12;
|
||||||
|
elseif datainvio == 13
|
||||||
|
nuovofile = 13;
|
||||||
|
else
|
||||||
|
nuovofile = meseadesso;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
nuovofile = datainvio;
|
||||||
|
end
|
||||||
|
fprintf(fileID,fmt,nuovofile);
|
||||||
|
fprintf(fileID,fmt,attivaReport);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
%% Email
|
||||||
|
setpref('Internet','E_mail','alert@aseltd.eu');
|
||||||
|
setpref('Internet','SMTP_Server','smtps.aruba.it');
|
||||||
|
setpref('Internet','SMTP_Username','alert@aseltd.eu');
|
||||||
|
setpref('Internet','SMTP_Password','Ase#2013!20@bat');
|
||||||
|
props=java.lang.System.getProperties;
|
||||||
|
pp=props.setProperty('mail.smtp.auth','true'); %#ok
|
||||||
|
pp=props.setProperty('mail.smtp.socketFactory.class','javax.net.ssl.SSLSocketFactory'); %#ok
|
||||||
|
pp=props.setProperty('mail.smtp.socketFactory.port','465'); %#ok
|
||||||
|
|
||||||
|
% Uso il siteID per identificare il nome del sito
|
||||||
|
comando = ['select name from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
NomeSito = num2str(cell2mat(curs.Data));
|
||||||
|
|
||||||
|
subject_ITA = (['CRASH del Report Automatico - ' NomeSito '']);
|
||||||
|
testo = cellstr('Ciao Andrea e Alessandro,');
|
||||||
|
testobis = cellstr('');
|
||||||
|
testo2 = cellstr(['Nella funzione Report_ASE avete scritto qualche minchiata per cui il SW crasha. Vi prego di correggermi '...
|
||||||
|
'o continuer' char(243) ' a crashare e ad assillarvi con questa mail. Sono talmente stupido che non sono nemmeno '...
|
||||||
|
'riuscito a lanciare il software esterno Report =( .Troverete l''errore in allegato.']);
|
||||||
|
message_ITA = [testo; testobis; testo2; testobis];
|
||||||
|
message = cellstr('Tanti Blip e Blop a te, ');
|
||||||
|
message2 = cellstr('Software ATD');
|
||||||
|
message_ITA = [message_ITA; message; message2];
|
||||||
|
|
||||||
|
recipients_ASE{1,1} = 'alessandro.valletta@aseltd.eu';
|
||||||
|
recipients_ASE{2,1} = 'andrea.carri@aseltd.eu';
|
||||||
|
|
||||||
|
allegato = FileErr;
|
||||||
|
|
||||||
|
sendmail(recipients_ASE, subject_ITA, message_ITA, allegato)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'report_ASE function executed correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
diary off
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
130
ATD/SMS.m
Executable file
130
ATD/SMS.m
Executable file
@@ -0,0 +1,130 @@
|
|||||||
|
function SMS(IDcentralina,DTcatena,Sito,Users_SMS,Criterio,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
|
||||||
|
[rU,cU] = size(Users_SMS);
|
||||||
|
NumTel = cell(1);
|
||||||
|
Language = cell(1);
|
||||||
|
j = 1;
|
||||||
|
if cU > 1
|
||||||
|
for i = 1:rU
|
||||||
|
if isempty(Users_SMS{i,6}) == 0 % l'utente ha un numero di telefono
|
||||||
|
NumTel(j,1) = Users_SMS(i,6);
|
||||||
|
Language(j,1) = Users_SMS(i,4);
|
||||||
|
j = j+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%% ------ INVIO SMS TRAMITE MAIL-TO-SMS SKEBBY -------
|
||||||
|
|
||||||
|
% Settaggio Email mittente
|
||||||
|
setpref('Internet','E_mail','aseparma@gmail.com');
|
||||||
|
setpref('Internet','SMTP_Server','smtp.gmail.com');
|
||||||
|
setpref('Internet','SMTP_Username','aseparma@gmail.com');
|
||||||
|
setpref('Internet','SMTP_Password','Mums@2016');
|
||||||
|
props=java.lang.System.getProperties;
|
||||||
|
pp=props.setProperty('mail.smtp.auth','true'); %#ok
|
||||||
|
pp=props.setProperty('mail.smtp.socketFactory.class','javax.net.ssl.SSLSocketFactory'); %#ok
|
||||||
|
pp=props.setProperty('mail.smtp.socketFactory.port','465'); %#ok
|
||||||
|
|
||||||
|
if strcmp(Criterio,'Fukuzono')
|
||||||
|
sms = 1;
|
||||||
|
elseif strcmp(Criterio,'FIFA')
|
||||||
|
sms = 2;
|
||||||
|
elseif strcmp(Criterio,'Soglie')
|
||||||
|
sms = 3;
|
||||||
|
end
|
||||||
|
|
||||||
|
% --- Invio sms di allertamento utenti ---
|
||||||
|
[r,~]=size(NumTel);
|
||||||
|
Condizione = cell2mat(NumTel);
|
||||||
|
|
||||||
|
if isempty(Condizione) == 0 % almeno un utente da avvisare
|
||||||
|
for k=1:r
|
||||||
|
check = char(NumTel(k,1));
|
||||||
|
[~,cC] = size(check);
|
||||||
|
if cC >= 1
|
||||||
|
if Language{k,1} == 2 %ITA
|
||||||
|
if sms == 1
|
||||||
|
testosms = (['ALLARME - Criterio Inverso della Velocità attivato per la Centralina ' IDcentralina...
|
||||||
|
', Catena ' DTcatena ' nel sito di ' Sito '. Controllare l''email per maggiori dettagli.']); %testo sms
|
||||||
|
elseif sms == 2
|
||||||
|
testosms = (['ALLARME - Criterio FIFA attivato per la Centralina ' IDcentralina...
|
||||||
|
', Catena ' DTcatena ' nel sito di ' Sito '. Controllare l''email per maggiori dettagli.']); %testo sms
|
||||||
|
elseif sms == 3
|
||||||
|
testosms = (['ALLARME - Soglie superate per la Centralina ' IDcentralina...
|
||||||
|
', Catena ' DTcatena ' nel sito di ' Sito '. Controllare l''email per maggiori dettagli.']); %testo sms
|
||||||
|
end
|
||||||
|
else %ENG
|
||||||
|
if sms == 1
|
||||||
|
testosms = (['ALARM - Inverse of Velocity Criterion Activated for Datalogger ' IDcentralina ', Array ' DTcatena ', Site: ' Sito...
|
||||||
|
'. Check the email for further details. ''']); %testo sms
|
||||||
|
elseif sms == 2
|
||||||
|
testosms = (['ALARM - FIFA Criterion Activated for Datalogger ' IDcentralina ', Array ' DTcatena ', Site: ' Sito...
|
||||||
|
'. Check the email for further details. ''']); %testo sms
|
||||||
|
elseif sms == 3
|
||||||
|
testosms = (['ALARM - Thresholds activated for Datalogger ' IDcentralina ', Array ' DTcatena ', Site: ' Sito...
|
||||||
|
'. Check the email for further details. ''']); %testo sms
|
||||||
|
end
|
||||||
|
end
|
||||||
|
NUMERO_TEL = num2str(cell2mat(NumTel(k,1))); % numero telefono
|
||||||
|
soggetto = 'ASE: Allarme Fukuzono!';
|
||||||
|
utente = [NUMERO_TEL '@classic.skebby.com'];
|
||||||
|
sendmail(utente,soggetto,testosms)
|
||||||
|
if sms == 1
|
||||||
|
text = ['Alert of Level #5 SMS sent to ' NUMERO_TEL '!'];
|
||||||
|
elseif sms == 2
|
||||||
|
text = ['Alert of Red Code SMS sent to ' NUMERO_TEL '!'];
|
||||||
|
elseif sms == 3
|
||||||
|
text = ['Alert SMS sent to ' NUMERO_TEL ' for the thresholds overcoming!'];
|
||||||
|
end
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
% scrivo invio sms a utenti autorizzati nel logfile
|
||||||
|
text = 'Alarm activated, email-to-sms process completed - Alert sent to authorized users!';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
% --- Invio sms a destinatari ASE ---
|
||||||
|
recipients_ITA{1,1} = '+393482453680'; % Alessandro Valletta
|
||||||
|
recipients_ITA{2,1} = '+393493048545'; % Andrea Carri
|
||||||
|
recipients_ITA{3,1} = '+393406654863'; % Roberto Savi
|
||||||
|
recipients_ITA{4,1} = '+393485113211'; % Andrea Segalini
|
||||||
|
[rASE,~]=size(recipients_ITA);
|
||||||
|
|
||||||
|
for z = 1:rASE
|
||||||
|
if sms == 1
|
||||||
|
smsASE = (['ALLARME di livello massimo - Criterio di Fukuzono Attivato per la Centralina' IDcentralina...
|
||||||
|
', Catena ' DTcatena ' nel sito di ' Sito '. Controllare l''email per maggiori dettagli.']);
|
||||||
|
soggettoASE = 'ASE: Allarme Fukuzono!';
|
||||||
|
elseif sms == 2
|
||||||
|
smsASE = (['ALLARME - Criterio FIFA Attivato per la Centralina' IDcentralina...
|
||||||
|
', Catena ' DTcatena ' nel sito di ' Sito '. Controllare l''email per maggiori dettagli.']);
|
||||||
|
soggettoASE = 'ASE: Allarme FIFA!';
|
||||||
|
elseif sms == 3
|
||||||
|
smsASE = (['ALLARME - Soglie superate per la Centralina' IDcentralina...
|
||||||
|
', Catena ' DTcatena ' nel sito di ' Sito '. Controllare l''email per maggiori dettagli.']);
|
||||||
|
soggettoASE = 'ASE: Allarme Soglie!';
|
||||||
|
end
|
||||||
|
Num_ASE = num2str(cell2mat(recipients_ITA(z,1))); % numero telefono ASE
|
||||||
|
utenteASE = [Num_ASE '@classic.skebby.com'];
|
||||||
|
sendmail(utenteASE,soggettoASE,smsASE)
|
||||||
|
% scrivo invio sms a utenti autorizzati nel logfile
|
||||||
|
if sms == 1
|
||||||
|
text = ['Alert of Level #5 SMS sent to ' Num_ASE '!'];
|
||||||
|
elseif sms == 2
|
||||||
|
text = ['Alert of Red Code SMS sent to ' Num_ASE '!'];
|
||||||
|
elseif sms == 3
|
||||||
|
text = ['Alert SMS sent to ' NUMERO_TEL ' for the thresholds overcoming!'];
|
||||||
|
end
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'Alarm activated, email-to-sms process completed - Alert sent to ASE users!';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
123
ATD/SWSearch.m
Executable file
123
ATD/SWSearch.m
Executable file
@@ -0,0 +1,123 @@
|
|||||||
|
function [yesRSN,yesMusa] = SWSearch(idTool,conn,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'SWSearch function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
yesRSN = 0;
|
||||||
|
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
|
||||||
|
|
||||||
|
%% RSN Link
|
||||||
|
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 38 order by num'];
|
||||||
|
Leggo = fetch(conn,comando);
|
||||||
|
[~,cL] = size(Leggo);
|
||||||
|
if cL > 1
|
||||||
|
yesRSN = 1;
|
||||||
|
text = 'RSN Links identified, RSN relaunch activated';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% RSN Link HR
|
||||||
|
comando = ['select num, depth from nodes where tool_id = ''' idTool ''' and nodetype_id = 39 order by num'];
|
||||||
|
Leggo = fetch(conn,comando);
|
||||||
|
[~,cL] = size(Leggo);
|
||||||
|
if cL > 1
|
||||||
|
yesRSN = 1;
|
||||||
|
text = 'RSN Links HR identified, RSN relaunch activated';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Trigger Link
|
||||||
|
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 40 order by num'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Leggo = curs.Data;
|
||||||
|
[~,cL] = size(Leggo);
|
||||||
|
if cL > 1
|
||||||
|
yesRSN = 1;
|
||||||
|
text = 'Trigger Links identified, RSN relaunch activated';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% G-Flow Link
|
||||||
|
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 48 order by num'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Leggo = curs.Data;
|
||||||
|
[~,cL] = size(Leggo);
|
||||||
|
if cL > 1
|
||||||
|
yesRSN = 1;
|
||||||
|
text = 'G-Flow Links identified, RSN relaunch activated';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% G-Shock Link
|
||||||
|
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 50 order by num'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Leggo = curs.Data;
|
||||||
|
[~,cL] = size(Leggo);
|
||||||
|
if cL > 1
|
||||||
|
yesRSN = 1;
|
||||||
|
text = 'G-Shock Links identified, RSN relaunch activated';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Debris Link
|
||||||
|
comando = ['select num, depth, measurment from nodes where tool_id = ''' idTool ''' and nodetype_id = 49 order by num'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Leggo = curs.Data;
|
||||||
|
[~,cL] = size(Leggo);
|
||||||
|
if cL > 1
|
||||||
|
yesRSN = 1;
|
||||||
|
text = 'Debris Links identified, RSN relaunch activated';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'SWScheme function ended';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
225
ATD/Siren.m
Executable file
225
ATD/Siren.m
Executable file
@@ -0,0 +1,225 @@
|
|||||||
|
function alarms = Siren(siteID,yesTuL,yesRL,yesTLH,yesTLHRH,yesPCL,yesPCLHR,...
|
||||||
|
yesCrL,yes3DCrL,yes2DCrL,yesEL,yes3DEL,yesWEL,yesMPBEL,datainiTuL,tempoiniTuL,...
|
||||||
|
datainiRL,tempoiniRL,datainiTLH,tempoiniTLH,datainiTLHRH,tempoiniTLHRH,...
|
||||||
|
datainiPCL,tempoiniPCL,datainiPCLHR,tempoiniPCLHR,datainiCrL,tempoiniCrL,...
|
||||||
|
dataini3DCrL,tempoini3DCrL,dataini2DCrL,tempoini2DCrL,...
|
||||||
|
datainiEL,tempoiniEL,dataini3DEL,tempoini3DEL,...
|
||||||
|
datainiWEL,tempoiniWEL,datainiMPBEL,tempoiniMPBEL,ARRAYdate_TuL,ARRAYdate_RL,...
|
||||||
|
ARRAYdate_TLH,ARRAYdate_TLHRH,ARRAYdate_PCL,ARRAYdate_PCLHR,ARRAYdate_CrL,...
|
||||||
|
ARRAYdate_3DCrL,ARRAYdate_2DCrL,ARRAYdate_EL,ARRAYdate_3DEL,ARRAYdate_WEL,ARRAYdate_MPBEL,...
|
||||||
|
conn,date,time,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
|
||||||
|
text = 'Siren function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% Scarico l'allarme relativo al sito
|
||||||
|
comando = ['select id, name, ctrltype_id from ctrltools where site_id = ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
alarms = curs.Data;
|
||||||
|
[rA,cA] = size(alarms);
|
||||||
|
|
||||||
|
sirena = 0;
|
||||||
|
if rA > 0 && cA > 1
|
||||||
|
for aa = 1:rA
|
||||||
|
if cell2mat(alarms(aa,3)) == 1
|
||||||
|
sirena = 1;
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if cA ~= 1 && sirena == 1
|
||||||
|
if yesTuL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_TuL;
|
||||||
|
elseif yesRL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_RL;
|
||||||
|
elseif yesTLH == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_TLH;
|
||||||
|
elseif yesTLHRH == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_TLHRH;
|
||||||
|
elseif yesPCL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_PCL;
|
||||||
|
elseif yesPCLHR == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_PCLHR;
|
||||||
|
elseif yesCrL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_CrL;
|
||||||
|
elseif yes3DCrL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_3DCrL;
|
||||||
|
elseif yes2DCrL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_2DCrL;
|
||||||
|
elseif yesEL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_EL;
|
||||||
|
elseif yes3DEL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_3DEL;
|
||||||
|
elseif yesWEL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_WEL;
|
||||||
|
elseif yesMPBEL == 1
|
||||||
|
ARRAYdateAL = ARRAYdate_MPBEL;
|
||||||
|
end
|
||||||
|
[ListaDate,~] = size(ARRAYdateAL);
|
||||||
|
val_AL = zeros(ListaDate,rA);
|
||||||
|
StoricoAllarmi = zeros(ListaDate,rA);
|
||||||
|
% Attivazione della Sirena al superamento di una determinata soglia
|
||||||
|
|
||||||
|
if yesTuL == 1
|
||||||
|
dataini = datainiTuL;
|
||||||
|
tempoini = tempoiniTuL;
|
||||||
|
elseif yesRL == 1
|
||||||
|
dataini = datainiRL;
|
||||||
|
tempoini = tempoiniRL;
|
||||||
|
elseif yesTLH == 1
|
||||||
|
dataini = datainiTLH;
|
||||||
|
tempoini = tempoiniTLH;
|
||||||
|
elseif yesTLHRH == 1
|
||||||
|
dataini = datainiTLHRH;
|
||||||
|
tempoini = tempoiniTLHRH;
|
||||||
|
elseif yesPCL == 1
|
||||||
|
dataini = datainiPCL;
|
||||||
|
tempoini = tempoiniPCL;
|
||||||
|
elseif yesPCLHR == 1
|
||||||
|
dataini = datainiPCLHR;
|
||||||
|
tempoini = tempoiniPCLHR;
|
||||||
|
elseif yesCrL == 1
|
||||||
|
dataini = datainiCrL;
|
||||||
|
tempoini = tempoiniCrL;
|
||||||
|
elseif yes3DCrL == 1
|
||||||
|
dataini = dataini3DCrL;
|
||||||
|
tempoini = tempoini3DCrL;
|
||||||
|
elseif yes2DCrL == 1
|
||||||
|
dataini = dataini2DCrL;
|
||||||
|
tempoini = tempoini2DCrL;
|
||||||
|
elseif yesEL == 1
|
||||||
|
dataini = datainiEL;
|
||||||
|
tempoini = tempoiniEL;
|
||||||
|
elseif yes3DEL == 1
|
||||||
|
dataini = dataini3DEL;
|
||||||
|
tempoini = tempoini3DEL;
|
||||||
|
elseif yesWEL == 1
|
||||||
|
dataini = datainiWEL;
|
||||||
|
tempoini = tempoiniWEL;
|
||||||
|
elseif yesMPBEL == 1
|
||||||
|
dataini = datainiMPBEL;
|
||||||
|
tempoini = tempoiniMPBEL;
|
||||||
|
end
|
||||||
|
dateCheck = [date ' ' time];
|
||||||
|
if dataini < datenum(dateCheck)
|
||||||
|
dataini = date;
|
||||||
|
tempoini = time;
|
||||||
|
else
|
||||||
|
dataini = datestr(dataini,'yyyy-mm-dd HH:MM:SS');
|
||||||
|
end
|
||||||
|
|
||||||
|
Control = 1;
|
||||||
|
while Control == 1
|
||||||
|
for nn = 1:rA
|
||||||
|
% Scarico i dati storici di attivazione dell'allarme
|
||||||
|
comando = ['select EventDate, EventTime, X from ELABDATACTRL where EventDate = ''' ...
|
||||||
|
dataini ''' and EventTime >= ''' tempoini ''' and CtrlToolName = '''...
|
||||||
|
char(alarms(nn,2)) ''' and NodeNum = 1 '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
AlarmTot_1 = curs.Data; % numero cumulato di attivazioni prima della lettura in elaborazione
|
||||||
|
|
||||||
|
comando = ['select EventDate, EventTime, X from ELABDATACTRL where EventDate > ''' ...
|
||||||
|
dataini ''' and CtrlToolName = ''' char(alarms(nn,2)) ''' and NodeNum = 1 '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
AlarmTot_2 = curs.Data; % numero cumulato di attivazioni prima della lettura in elaborazione
|
||||||
|
|
||||||
|
[r1,c1] = size(AlarmTot_1);
|
||||||
|
[r2,c2] = size(AlarmTot_2);
|
||||||
|
if r1 == 1 && c1 == 1
|
||||||
|
if r2 == 1 && c2 == 1
|
||||||
|
if datenum(dataini) < datenum(dateCheck)
|
||||||
|
AlarmTot(1,1) = cellstr(date);
|
||||||
|
AlarmTot(1,2) = cellstr(time);
|
||||||
|
AlarmTot(1,3) = num2cell(0);
|
||||||
|
Control = 0;
|
||||||
|
else
|
||||||
|
dataini = dataini-1;
|
||||||
|
break
|
||||||
|
end
|
||||||
|
else
|
||||||
|
AlarmTot = AlarmTot_2;
|
||||||
|
Control = 0;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Control = 0;
|
||||||
|
if r2 == 1 && c2 == 1
|
||||||
|
AlarmTot = AlarmTot_1;
|
||||||
|
else
|
||||||
|
AlarmTot = [AlarmTot_1; AlarmTot_2];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
[rA,~] = size(AlarmTot);
|
||||||
|
Data = [cell2mat(AlarmTot(:,1)) repmat(' ', [rA,1]) cell2mat(AlarmTot(:,2))];
|
||||||
|
Data = datenum(Data);
|
||||||
|
Var = find(Data < datenum(ARRAYdateAL(1,1)));
|
||||||
|
if isempty(Var) == 1
|
||||||
|
StoricoAllarmi(:,nn) = cumsum(val_AL);
|
||||||
|
else
|
||||||
|
StoricoAllarmi(:,nn) = cumsum(val_AL)+cell2mat(AlarmTot(Var(end),3));
|
||||||
|
end
|
||||||
|
|
||||||
|
DATAinsert = cell(ListaDate,6);
|
||||||
|
% Creo i dati da scrivere
|
||||||
|
for ii=1:ListaDate
|
||||||
|
DATAinsert{ii,1} = alarms(nn,2);
|
||||||
|
DATAinsert{ii,2} = datestr(ARRAYdateAL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,3} = datestr(ARRAYdateAL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,4} = val_AL(ii,nn);
|
||||||
|
DATAinsert{ii,5} = StoricoAllarmi(ii,nn);
|
||||||
|
DATAinsert{ii,6} = 1;
|
||||||
|
end
|
||||||
|
idElabData = zeros(ListaDate,1); % Contiene gli id delle date delle quali ho già dati
|
||||||
|
cc = 1; % contatore
|
||||||
|
% Cerco su DB se i dati sono da aggiornare o scrivere
|
||||||
|
for ii=1:ListaDate
|
||||||
|
dString = datestr(ARRAYdateAL(ii),'yyyy-mm-dd');
|
||||||
|
tString = datestr(ARRAYdateAL(ii),'HH:MM:SS');
|
||||||
|
|
||||||
|
comando = ['select idElabDataCtrl from ELABDATACTRL where CtrlToolName = '''...
|
||||||
|
char(alarms(nn,2)) ''' and NodeNum = 1 and EventDate = ''' ...
|
||||||
|
dString ''' and EventTime = ''' tString ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
idDate = curs.Data;
|
||||||
|
if strcmp(idDate,'No Data')
|
||||||
|
idElabData(cc,1) = 0; % 0 indica che il dato non è presente su DB
|
||||||
|
else
|
||||||
|
idElabData(cc,1) = cell2mat(idDate);
|
||||||
|
end
|
||||||
|
cc = cc+1;
|
||||||
|
% Scrivo o Aggiorno i dati
|
||||||
|
idData = idElabData(ii,1);
|
||||||
|
tablename = 'ELABDATACTRL';
|
||||||
|
if idData == 0 % Se la data non è su DB (=0), scrivo i dati
|
||||||
|
colnames = {'CtrlToolName','EventDate','EventTime','XShift','X','NodeNum',};
|
||||||
|
data = [DATAinsert(ii,1),DATAinsert(ii,2),DATAinsert(ii,3),...
|
||||||
|
DATAinsert(ii,4),DATAinsert(ii,5),DATAinsert(ii,6)];
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
else % altrimenti li aggiorno
|
||||||
|
colnames = {'XShift','X'};
|
||||||
|
data = [DATAinsert(ii,4),DATAinsert(ii,5)];
|
||||||
|
whereclause = ['WHERE CtrlToolName = ''' char(alarms(nn,2)) ...
|
||||||
|
''' and NodeNum = 1 and EventDate = ''' cell2mat(DATAinsert(ii,2))...
|
||||||
|
''' and EventTime = ''' cell2mat(DATAinsert(ii,3)) ''' '];
|
||||||
|
update(conn,tablename,colnames,data,whereclause)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
text = ['Data of Control Tools ' char(alarms(nn,2)) ' uploaded in the DB correctly'];
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'Siren function executed correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
60
ATD/Site_Info.m
Executable file
60
ATD/Site_Info.m
Executable file
@@ -0,0 +1,60 @@
|
|||||||
|
function [unitID,chainID,Chain_Scheme,num_nodi,alarms] = Site_Info(siteID,conn,FileName)
|
||||||
|
|
||||||
|
text = 'Site_Info function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% Scarico tutte le centraline presenti in sito
|
||||||
|
comando = ['select id, name from units where site_id = ''' siteID ''' order by name']; % il rapporto centralina sito è di 1 a 1
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
unitID = curs.Data;
|
||||||
|
|
||||||
|
col = size(unitID);
|
||||||
|
chainID = cell(1,4);
|
||||||
|
ini = 1;
|
||||||
|
for c = 1:col(1,1)
|
||||||
|
% dalle centraline presenti, risalgo alle catene disponibili
|
||||||
|
comando = ['select id, name from tools where unit_id = ''' num2str(cell2mat(unitID(c,1))) ''' order by name'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
chainID_down = curs.Data; % id tool, nome tool
|
||||||
|
[fin,~] = size(chainID_down);
|
||||||
|
fin = fin+ini-1;
|
||||||
|
chainID(ini:fin,3:4) = chainID_down;
|
||||||
|
for j = ini:fin
|
||||||
|
chainID(j,1:2) = unitID(c,1:2); % Id centralina, nome centralina, id tool, nome tool
|
||||||
|
end
|
||||||
|
ini = fin+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Scarico gli schemi delle catene
|
||||||
|
[col,~] = size(chainID); % Numero di Array
|
||||||
|
Chain_Scheme = cell(1,3);
|
||||||
|
num_nodi = zeros(col,1);
|
||||||
|
ini = 1;
|
||||||
|
cont = 1;
|
||||||
|
for c = 1:col(1,1)
|
||||||
|
comando = ['select nodetype_id, depth, num from nodes where tool_id = ''' num2str(cell2mat(chainID(c,3))) ''' order by num'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
scheme_down = curs.Data; % id nodo, profondità, numero
|
||||||
|
[fin,~] = size(scheme_down);
|
||||||
|
num_nodi(cont) = fin;
|
||||||
|
Chain_Scheme(1:fin,ini:ini+2) = scheme_down;
|
||||||
|
ini = ini+3;
|
||||||
|
cont = cont+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Scarico l'allarme relativo al sito
|
||||||
|
comando = ['select id, name, ctrltype_id, alarm_phone, conn_usr, conn_pwd, duedate from ctrltools where site_id = ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
alarms = curs.Data;
|
||||||
|
|
||||||
|
text = 'Site_Info function worked correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
308
ATD/Users_Def.m
Executable file
308
ATD/Users_Def.m
Executable file
@@ -0,0 +1,308 @@
|
|||||||
|
function [Mail,Users_Alert,Users_SMS,Users_Report,activeIT,activeEN,...
|
||||||
|
sms,siteID,NomeSito,ini_CoV] = Users_Def(IDcentralina,conn,FileName)
|
||||||
|
|
||||||
|
text = 'Users function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% A partire dalla centralina, risalgo al site ID
|
||||||
|
comando = ['select site_id from units where name like ''' IDcentralina ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
siteID = num2str(cell2mat(curs.Data));
|
||||||
|
|
||||||
|
% --- Cerco gli utenti ---
|
||||||
|
|
||||||
|
% - Definisco gli Users
|
||||||
|
% A partire dal site ID, risalgo al company ID
|
||||||
|
comando = ['select company_id, name, lat, lon, alarm_email from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Site = curs.Data;
|
||||||
|
Company_id = num2str(cell2mat(Site(1,1)));
|
||||||
|
Email_Alarm_Site = Site(1,5);
|
||||||
|
NomeSito = Site(1,2);
|
||||||
|
|
||||||
|
% A partire dal company ID, mi scarico le info relative a Send Email Alarm
|
||||||
|
comando = ['select send_alarm from companies where id like ''' Company_id ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Mail = cell2mat(curs.Data);
|
||||||
|
|
||||||
|
if Mail == 1 % Significa che invio Mail alla Company del Sito
|
||||||
|
% La Mail la mando SOLO alla mail indicata nel campo del Sito (per quanto riguarda la company cliente)
|
||||||
|
if isempty(cell2mat(Email_Alarm_Site)) == 0
|
||||||
|
if strcmp(char(Email_Alarm_Site),'null') == 0
|
||||||
|
US = Email_Alarm_Site;
|
||||||
|
check = cell2mat(strfind(US,','));
|
||||||
|
if isempty(check)==1
|
||||||
|
% A partire dal company ID, risalgo agli utenti e alla loro mail di
|
||||||
|
% quella company che sono admin
|
||||||
|
comando = ['select fname, lname, language_id, info, phone, sms_alarm, report, report_cov, '...
|
||||||
|
'allertamento from users where email like '''...
|
||||||
|
char(US) ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Info = curs.Data; % Cerco la lingua dell'unico destinatario
|
||||||
|
[~,cC] = size(Info);
|
||||||
|
if cC > 1
|
||||||
|
Users = Info(1:2);
|
||||||
|
Users(3) = US;
|
||||||
|
Users(4:5) = Info(3:4);
|
||||||
|
Users(6) = Info(5);
|
||||||
|
Users(7:10) = Info(6:9);
|
||||||
|
else
|
||||||
|
Users = [];
|
||||||
|
end
|
||||||
|
else
|
||||||
|
[~,cC] = size(check);
|
||||||
|
Users = cell(cC+1,6);
|
||||||
|
u = 1;
|
||||||
|
ini = 1;
|
||||||
|
for i=1:cC+1
|
||||||
|
utente = char(US);
|
||||||
|
% A partire dal company ID, risalgo agli utenti e alla loro mail di
|
||||||
|
% quella company che sono admin
|
||||||
|
if i == cC+1
|
||||||
|
comando = ['select fname, lname, language_id, info, phone, sms_alarm, report, report_cov, '...
|
||||||
|
'allertamento, email from users where email like ''' utente(ini:end) ''' '];
|
||||||
|
else
|
||||||
|
comando = ['select fname, lname, language_id, info, phone, sms_alarm, report, report_cov, '...
|
||||||
|
'allertamento, email from users where email like ''' utente(ini:check(i)-1) ''' '];
|
||||||
|
end
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Info = curs.Data; % Cerco la lingua dell'unico destinatario
|
||||||
|
[~,cI] = size(Info);
|
||||||
|
if cI ~= 1
|
||||||
|
Users(u,1:2) = Info(1:2);
|
||||||
|
Users(u,3) = Info(10);
|
||||||
|
Users(u,4:5) = Info(3:4);
|
||||||
|
Users(u,6) = Info(5);
|
||||||
|
Users(u,7:10) = Info(6:9);
|
||||||
|
u = u+1;
|
||||||
|
end
|
||||||
|
if i ~= cC+1
|
||||||
|
ini = check(i)+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Users = Users(1:u-1,:);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
% Company Manager
|
||||||
|
Role = ' 2 ';
|
||||||
|
% A partire dal company ID, risalgo agli utenti e alla loro mail di
|
||||||
|
% quella company che sono admin
|
||||||
|
comando = ['select fname, lname, email, language_id, info, phone, sms_alarm, report, report_cov, '...
|
||||||
|
'allertamento from users where company_id like ''' Company_id ''' and role_id = ''' Role ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Users = curs.Data;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
% Company Manager
|
||||||
|
Role = ' 2 ';
|
||||||
|
% A partire dal company ID, risalgo agli utenti e alla loro mail di
|
||||||
|
% quella company che sono admin
|
||||||
|
comando = ['select fname, lname, email, language_id, info, phone, sms_alarm, report, report_cov, '...
|
||||||
|
'allertamento from users where company_id like ''' Company_id ''' and role_id = ''' Role ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Users = curs.Data;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Users = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
% Elimino gli utenti che non possono essere allertati
|
||||||
|
[rU,cU] = size(Users);
|
||||||
|
al = 1;
|
||||||
|
sms = 1;
|
||||||
|
rpt = 1;
|
||||||
|
Users_Alert = cell(1,1);
|
||||||
|
Users_SMS = cell(1,1);
|
||||||
|
Users_Report = cell(1,1);
|
||||||
|
if cU > 1
|
||||||
|
for u = 1:rU
|
||||||
|
if cell2mat(Users(u,10)) == 1
|
||||||
|
[rUA,cUA] = size(Users_Alert);
|
||||||
|
if rUA == 1 && cUA == 1
|
||||||
|
clear Users_Alert
|
||||||
|
end
|
||||||
|
Users_Alert(al,:) = Users(u,:);
|
||||||
|
al = al+1;
|
||||||
|
if cell2mat(Users(u,7)) == 1
|
||||||
|
[rUA,cUA] = size(Users_SMS);
|
||||||
|
if rUA == 1 && cUA == 1
|
||||||
|
clear Users_SMS
|
||||||
|
end
|
||||||
|
Users_SMS(sms,:) = Users(u,:);
|
||||||
|
sms = sms+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if cell2mat(Users(u,8)) == 1
|
||||||
|
[rUA,cUA] = size(Users_Report);
|
||||||
|
if rUA == 1 && cUA == 1
|
||||||
|
clear Users_Report
|
||||||
|
end
|
||||||
|
Users_Report(rpt,:) = Users(u,:);
|
||||||
|
rpt = rpt+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ini_CoV = al;
|
||||||
|
|
||||||
|
% Cerco se allertare o meno i Cone of Visions
|
||||||
|
comando = ['select conn_path from units where name like ''' IDcentralina ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Auth = curs.Data; % Se pari a 1 autorizzo i Cone of Visions, altrimenti no
|
||||||
|
|
||||||
|
if strcmp(char(Auth),'Yes')
|
||||||
|
Mail = 1;
|
||||||
|
% Cone of vision
|
||||||
|
% A partire dal site ID, risalgo al USER ID degli utenti nel
|
||||||
|
% cone-of-vision per quel sito
|
||||||
|
comando = ['select user_id from coneofvisions where site_id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
CoV = cell2mat(curs.Data);
|
||||||
|
|
||||||
|
% A partire dal USER ID, risalgo agli utenti e alla loro email se sono company manager
|
||||||
|
[rC, ~] = size(CoV);
|
||||||
|
if strcmp(char(CoV(1,:)),'No Data') % almeno un utente da cercare nel database
|
||||||
|
Users_CoV = [];
|
||||||
|
else
|
||||||
|
ii = 1;
|
||||||
|
for i=1:rC
|
||||||
|
Utente = num2str(CoV(i,1));
|
||||||
|
Role = ' 2 ';
|
||||||
|
comando = ['select fname, lname, email, language_id, info, phone, sms_alarm, report, report_cov, '...
|
||||||
|
'allertamento from users where id = ''' Utente ''' and role_id = ''' Role ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
UC = curs.Data;
|
||||||
|
[~,cUC] = size(UC);
|
||||||
|
if cUC ~= 1
|
||||||
|
Users_CoV(ii,:) = UC;
|
||||||
|
ii = ii+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
[rUC,cUC] = size(Users_CoV);
|
||||||
|
[rUA,cUA] = size(Users_Alert);
|
||||||
|
if cUC > 1
|
||||||
|
for u = 1:rUC
|
||||||
|
if cell2mat(Users_CoV(u,10)) == 1 && cell2mat(Users_CoV(u,9)) == 1
|
||||||
|
salta = 0;
|
||||||
|
for cov = 1:rUA
|
||||||
|
if cUA > 1
|
||||||
|
A = strfind(char(Users_CoV(u,3)),char(Users_Alert(cov,3)));
|
||||||
|
if A == 1
|
||||||
|
salta = 1;
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if salta == 0
|
||||||
|
if cUA > 1
|
||||||
|
Users_Alert(al,:) = Users_CoV(u,:);
|
||||||
|
else
|
||||||
|
Users_Alert = Users_CoV(u,:);
|
||||||
|
end
|
||||||
|
al = al+1;
|
||||||
|
if cell2mat(Users_CoV(u,7)) == 1
|
||||||
|
Users_SMS(sms,:) = Users_CoV(u,:);
|
||||||
|
sms = sms+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if cell2mat(Users_CoV(u,9)) == 1
|
||||||
|
salta = 0;
|
||||||
|
for cov = 1:rUA
|
||||||
|
if cUA > 1
|
||||||
|
A = strfind(char(Users_CoV(u,3)),char(Users_Alert(cov,3)));
|
||||||
|
if A == 1
|
||||||
|
salta = 1;
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if salta == 0
|
||||||
|
[rUA,cUA] = size(Users_Report);
|
||||||
|
if rUA == 1 && cUA == 1
|
||||||
|
clear Users_Report
|
||||||
|
end
|
||||||
|
Users_Report(rpt,:) = Users_CoV(u,:);
|
||||||
|
rpt = rpt+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Users_CoV = [];
|
||||||
|
end
|
||||||
|
|
||||||
|
[rU,cU] = size(Users);
|
||||||
|
[rC,cC] = size(Users_CoV);
|
||||||
|
if cC > 1 && rC > 0 && cU > 1 % comando ha trovato informazioni e le ha scritte in Users
|
||||||
|
Users(rU+1:rU+rC,1:10) = Users_CoV;
|
||||||
|
elseif cC > 1 && rC > 0 && cU == 0
|
||||||
|
Users = Users_CoV;
|
||||||
|
end
|
||||||
|
|
||||||
|
[rU,~] = size(Users);
|
||||||
|
if rU == 0
|
||||||
|
Mail = 0;
|
||||||
|
end
|
||||||
|
% Controllo che la centralina non sia scaduta
|
||||||
|
comando = ['select duedate from units where name = ''' IDcentralina ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Date = curs.Data;
|
||||||
|
Check = cell2mat(Date);
|
||||||
|
if strcmp(Check,'null') || strcmp(Check,'No Data')
|
||||||
|
% La data di scadenza centralina non è impostata
|
||||||
|
sms = 1;
|
||||||
|
else
|
||||||
|
if datenum(Date) < now % Centralina scaduta
|
||||||
|
sms = 0;
|
||||||
|
Users_Alert = [];
|
||||||
|
Users_SMS = [];
|
||||||
|
Users_Report = [];
|
||||||
|
else
|
||||||
|
sms = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% A chi mando la mail
|
||||||
|
activeIT = 0;
|
||||||
|
activeEN = 0;
|
||||||
|
[~,c1] = size(Users_Alert);
|
||||||
|
[~,c2] = size(Users_Report);
|
||||||
|
if c1 == 1 && c2 == 1
|
||||||
|
Users_Lang = [];
|
||||||
|
elseif c1 == 1
|
||||||
|
Users_Lang = Users_Report;
|
||||||
|
elseif c2 == 1
|
||||||
|
Users_Lang = Users_Alert;
|
||||||
|
else
|
||||||
|
Users_Lang = [Users_Alert; Users_Report];
|
||||||
|
end
|
||||||
|
[rU,cU] = size(Users_Lang);
|
||||||
|
if cU >1 % sono presenti utenti a cui inviare la mail
|
||||||
|
for i = 1:rU
|
||||||
|
if Users_Lang{i,4} == 2
|
||||||
|
activeIT = 1;
|
||||||
|
else
|
||||||
|
activeEN = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'Users function worked correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
183
ATD/YesNo.m
Executable file
183
ATD/YesNo.m
Executable file
@@ -0,0 +1,183 @@
|
|||||||
|
%% funzione che attiva/disattiva l'elaborazione per una determinata tipologia di nodo
|
||||||
|
% Ad esempio se la matrice Tilt Link è vuota i Tilt Link non sono presenti
|
||||||
|
% e si scrive yesTL = 0, altrimenti se ci sono dei dati, yesTL = 1 e ne
|
||||||
|
% viene attivata l'elaborazione nelle fasi successive
|
||||||
|
|
||||||
|
function [yesTuL,yesRL,yesTLH,yesTLHRH,yesTLHR3DH,yesPCL,yesPCLHR,yesPCLHR3D,...
|
||||||
|
yesPL,yesLL,yesEL,yes3DEL,yesWEL,yesMPBEL,yesAL,yesCrL,yes3DCrL,yes2DCrL,...
|
||||||
|
yesDM,yesSM] = YesNo(NodoTunnelLink,NodoRadialLink,NodoTiltLinkH,NodoTiltLinkHRH,...
|
||||||
|
NodoTiltLinkHR3DH,NodoPreConvLink,NodoPreConvLinkHR,NodoPreConvLinkHR3D,...
|
||||||
|
NodoDistoMTLink,NodoPressureLink,NodoLoadLink,NodoExtensometerLink,...
|
||||||
|
Nodo3DExtensometerLink,NodoWireExtensometerLink,NodoMultiPointRodExtensometer,...
|
||||||
|
NodoAnalogLink,NodoCrackLink,Nodo3DCrackLink,Nodo2DCrackLink,NodoStressMeter,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'YesNo function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
%% Tunnel Link
|
||||||
|
[rTuL,cTuL] = size(NodoTunnelLink);
|
||||||
|
if rTuL==0 && cTuL==0
|
||||||
|
yesTuL = 0; % Non elaboro i Tunnel Link
|
||||||
|
else
|
||||||
|
yesTuL = 1; % attiva l'elaborazione dei Tunnel Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Radial Link
|
||||||
|
[rRL,cRL] = size(NodoRadialLink);
|
||||||
|
if rRL==0 && cRL==0
|
||||||
|
yesRL = 0; % Non elaboro i Radial Link
|
||||||
|
else
|
||||||
|
yesRL = 1; % attiva l'elaborazione dei Radial Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Tilt Link H
|
||||||
|
[rTLH,cTLH] = size(NodoTiltLinkH);
|
||||||
|
if rTLH==0 && cTLH==0
|
||||||
|
yesTLH = 0; % Non elaboro i Tilt Link H
|
||||||
|
else
|
||||||
|
yesTLH = 1; % attiva l'elaborazione dei Tilt Link H
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Tilt Link HR H
|
||||||
|
[rTLHRH,cTLHRH] = size(NodoTiltLinkHRH);
|
||||||
|
if rTLHRH==0 && cTLHRH==0
|
||||||
|
yesTLHRH = 0; % Non elaboro i Tilt Link HR H
|
||||||
|
else
|
||||||
|
yesTLHRH = 1; % attiva l'elaborazione dei Tilt Link HR H
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Tilt Link HR 3D H
|
||||||
|
[rTLHR3DH,cTLHR3DH] = size(NodoTiltLinkHR3DH);
|
||||||
|
if rTLHR3DH==0 && cTLHR3DH==0
|
||||||
|
yesTLHR3DH = 0; % Non elaboro i Tilt Link HR 3D H
|
||||||
|
else
|
||||||
|
yesTLHR3DH = 1; % attiva l'elaborazione dei Tilt Link HR 3D H
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Pre Conv Link
|
||||||
|
[rPCL,cPCL] = size(NodoPreConvLink);
|
||||||
|
if rPCL==0 && cPCL==0
|
||||||
|
yesPCL = 0; % Non elaboro i PreConv Link
|
||||||
|
else
|
||||||
|
yesPCL = 1; % attiva l'elaborazione dei PreConv Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Pre Conv Link H
|
||||||
|
[rPCLHR,cPCLhr] = size(NodoPreConvLinkHR);
|
||||||
|
if rPCLHR==0 && cPCLhr==0
|
||||||
|
yesPCLHR = 0; % Non elaboro i Pre Conv Link HR
|
||||||
|
else
|
||||||
|
yesPCLHR = 1; % attiva l'elaborazione dei Pre Conv Link HR
|
||||||
|
end
|
||||||
|
|
||||||
|
%% PreConv Link HR 3D
|
||||||
|
[rPCLHR3D,cPCLHR3D] = size(NodoPreConvLinkHR3D);
|
||||||
|
if rPCLHR3D==0 && cPCLHR3D==0
|
||||||
|
yesPCLHR3D = 0; % Non elaboro i PreConv Link HR 3D
|
||||||
|
else
|
||||||
|
yesPCLHR3D = 1; % attiva l'elaborazione dei PreConv Link HR 3D
|
||||||
|
end
|
||||||
|
|
||||||
|
%% DistoMT Link
|
||||||
|
[rDM,cDM] = size(NodoDistoMTLink);
|
||||||
|
if rDM==0 && cDM==0
|
||||||
|
yesDM = 0; % Non elaboro i DistoMT Link
|
||||||
|
else
|
||||||
|
yesDM = 1; % attiva l'elaborazione dei DistoMT Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Pressure Link
|
||||||
|
[rPL,cPL] = size(NodoPressureLink);
|
||||||
|
if rPL==0 && cPL==0
|
||||||
|
yesPL = 0; % Non elaboro i Pressure Link
|
||||||
|
else
|
||||||
|
yesPL = 1; % attiva l'elaborazione dei Pressure Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Load Link
|
||||||
|
[rLL,cLL] = size(NodoLoadLink);
|
||||||
|
if rLL==0 && cLL==0
|
||||||
|
yesLL = 0; % Non elaboro i Load Link
|
||||||
|
else
|
||||||
|
yesLL = 1; % attiva l'elaborazione dei Load Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Extensometer Link
|
||||||
|
[rEL,cEL] = size(NodoExtensometerLink);
|
||||||
|
if rEL==0 && cEL==0
|
||||||
|
yesEL = 0; % Non elaboro gli Extensometer Link
|
||||||
|
else
|
||||||
|
yesEL = 1; % attiva l'elaborazione degli Extensometer Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% 3D extensometer Link
|
||||||
|
[r3DEL,c3DEL] = size(Nodo3DExtensometerLink);
|
||||||
|
if r3DEL==0 && c3DEL==0
|
||||||
|
yes3DEL = 0; % Non elaboro i 3D extensometer Link
|
||||||
|
else
|
||||||
|
yes3DEL = 1; % attiva l'elaborazione dei 3D extensometer Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Wire Extensometer Link
|
||||||
|
[rWEL,cWEL] = size(NodoWireExtensometerLink);
|
||||||
|
if rWEL==0 && cWEL==0
|
||||||
|
yesWEL = 0; % Non elaboro i Wire Extensometer Link
|
||||||
|
else
|
||||||
|
yesWEL = 1; % attiva l'elaborazione dei Wire Extensometer Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Multi Point Bore Rod Extensometer
|
||||||
|
[rMPBEL,cMPBEL] = size(NodoMultiPointRodExtensometer);
|
||||||
|
if rMPBEL==0 && cMPBEL==0
|
||||||
|
yesMPBEL = 0; % Non elaboro i Multi Point Bore Rod Extensometer
|
||||||
|
else
|
||||||
|
yesMPBEL = 1; % attiva l'elaborazione dei Multi Point Bore Rod Extensometer
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Analog Link
|
||||||
|
[rAL,cAL] = size(NodoAnalogLink);
|
||||||
|
if rAL==0 && cAL==0
|
||||||
|
yesAL = 0; % Non elaboro gli Analog Link
|
||||||
|
else
|
||||||
|
yesAL = 1; % attiva l'elaborazione degli Analog Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Crack Link
|
||||||
|
[rCrL,cCrL] = size(NodoCrackLink);
|
||||||
|
if rCrL==0 && cCrL==0
|
||||||
|
yesCrL = 0; % Non elaboro i Crack Link
|
||||||
|
else
|
||||||
|
yesCrL = 1; % attiva l'elaborazione dei Crack Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% 3D Crack Link
|
||||||
|
[r3DCrL,c3DCrL] = size(Nodo3DCrackLink);
|
||||||
|
if r3DCrL==0 && c3DCrL==0
|
||||||
|
yes3DCrL = 0; % Non elaboro i 3D Crack Link
|
||||||
|
else
|
||||||
|
yes3DCrL = 1; % attiva l'elaborazione dei 3D Crack Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% 2D Crack Link
|
||||||
|
[r2DCrL,c2DCrL] = size(Nodo2DCrackLink);
|
||||||
|
if r2DCrL==0 && c2DCrL==0
|
||||||
|
yes2DCrL = 0; % Non elaboro i 3D Crack Link
|
||||||
|
else
|
||||||
|
yes2DCrL = 1; % attiva l'elaborazione dei 3D Crack Link
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Stress Meter
|
||||||
|
[rSM,cSM] = size(NodoStressMeter);
|
||||||
|
if rSM==0 && cSM==0
|
||||||
|
yesSM = 0; % Non elaboro i Stress Meter
|
||||||
|
else
|
||||||
|
yesSM = 1; % attiva l'elaborazione dei Stress Meter
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'Activation parameters for the elaboration defined correctly, YesNo function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
305
ATD/alert_Levels.m
Executable file
305
ATD/alert_Levels.m
Executable file
@@ -0,0 +1,305 @@
|
|||||||
|
function alert_Levels(rLL,rCrL,DatiLoad,DatiCrack,ARRAYdate_LL,ARRAYdate_CrL,...
|
||||||
|
ErrLoadLink,~,NodoLoadLink,NodoCrackLink,IDcentralina,DTcatena,...
|
||||||
|
sms,date,time,conn,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'alert_Levels function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
alert = 0;
|
||||||
|
alarm = 0;
|
||||||
|
if strcmp(IDcentralina,'ID0081') && strcmp(DTcatena,'DT0009') % Varazze - Casanova - Via Fossello
|
||||||
|
[numDate,~] = size(ARRAYdate_LL);
|
||||||
|
indexALA = zeros(1,2);
|
||||||
|
indexALE = zeros(1,2);
|
||||||
|
cI = 1;
|
||||||
|
cI2 = 1;
|
||||||
|
for s = 1:rLL
|
||||||
|
for n = 1:numDate
|
||||||
|
if DatiLoad(n,s) > 588.4 % kN
|
||||||
|
if ErrLoadLink(n,s) == 0 || ErrLoadLink(n,s) == 0.5 % Il nodo non è in errore
|
||||||
|
alarm = 1;
|
||||||
|
indexALA(cI,1) = n; % Data
|
||||||
|
indexALA(cI,2) = s; % sensore
|
||||||
|
cI = cI+1;
|
||||||
|
end
|
||||||
|
% elseif DatiLoad(n,s)-DatiLoad(n-1,s) > 0.3 % mm
|
||||||
|
% if ErrLoadLink(n,s) == 0 || ErrLoadLink(n,s) == 0.5 % Il nodo non è in errore
|
||||||
|
% alert = 1;
|
||||||
|
% indexALE(cI2,1) = n; % Data
|
||||||
|
% indexALE(cI2,2) = s; % fessurimetro
|
||||||
|
% cI2 = cI2+1;
|
||||||
|
% end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif strcmp(IDcentralina,'ID0082') && strcmp(DTcatena,'DT0010') % Riva di Tures
|
||||||
|
[numDate,~] = size(ARRAYdate_CrL);
|
||||||
|
indexALA = zeros(1,2);
|
||||||
|
indexALE = zeros(1,2);
|
||||||
|
cI = 1;
|
||||||
|
cI2 = 1;
|
||||||
|
fuoriSoglia1 = zeros(numDate,rCrL); % Sensore 1 > 50 mm
|
||||||
|
fuoriSoglia2 = zeros(numDate,rCrL); % Sensore 2 > 5 mm
|
||||||
|
fuoriSoglia3 = zeros(numDate,rCrL); % Sensore 1 > 20 mm per 10 letture
|
||||||
|
fuoriSoglia4 = zeros(numDate,rCrL); % Sensore 1 > 10 mm per 10 letture
|
||||||
|
RIF = zeros(1,rCrL);
|
||||||
|
for s = 1:rCrL
|
||||||
|
NodeNumCrL = num2str(cell2mat(NodoCrackLink(s,2))); % scarico i dati del primo nodo Crack Link
|
||||||
|
comando = ['select XShift from ElabDataView where EventDate = ''' ...
|
||||||
|
date ''' and EventTime >= ''' time ''' and UnitName = ''' IDcentralina ...
|
||||||
|
''' and ToolNameID = ''' DTcatena ''' and NodeNum = ' NodeNumCrL ' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Data_LastElab = curs.Data;
|
||||||
|
RIF(1,s) = cell2mat(Data_LastElab(1,1));
|
||||||
|
for n = 1:numDate
|
||||||
|
if DatiCrack(n,s) - RIF(1,s) > 50 % mm
|
||||||
|
fuoriSoglia1(n,s) = 1;
|
||||||
|
end
|
||||||
|
if DatiCrack(n,s) - RIF(1,s) > 5 % mm
|
||||||
|
fuoriSoglia2(n,s) = 1;
|
||||||
|
end
|
||||||
|
if n >= 10
|
||||||
|
cont = 0;
|
||||||
|
cont2 = 0;
|
||||||
|
for aa = n-9:n
|
||||||
|
if DatiCrack(aa,s) - RIF(1,s) > 20 % mm
|
||||||
|
cont = cont+1;
|
||||||
|
end
|
||||||
|
if DatiCrack(aa,s) - RIF(1,s) > 10 % mm
|
||||||
|
cont2 = cont2+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if cont >= 10
|
||||||
|
fuoriSoglia3(n,s) = 1;
|
||||||
|
end
|
||||||
|
if cont2 >= 10
|
||||||
|
fuoriSoglia4(n,s) = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for s = 1:rCrL
|
||||||
|
for n = 10:numDate
|
||||||
|
if fuoriSoglia1(n,s) == 1
|
||||||
|
if fuoriSoglia3(n,s) == 1
|
||||||
|
if s == 1
|
||||||
|
if fuoriSoglia2(n,2) == 1 || fuoriSoglia2(n,3) == 1 || fuoriSoglia2(n,4) == 1
|
||||||
|
alarm = 1;
|
||||||
|
indexALA(cI,1) = n; % Data
|
||||||
|
indexALA(cI,2) = s; % sensore
|
||||||
|
cI = cI+1;
|
||||||
|
end
|
||||||
|
elseif s == 2
|
||||||
|
if fuoriSoglia2(n,1) == 1 || fuoriSoglia2(n,3) == 1 || fuoriSoglia2(n,4) == 1
|
||||||
|
alarm = 1;
|
||||||
|
indexALA(cI,1) = n; % Data
|
||||||
|
indexALA(cI,2) = s; % sensore
|
||||||
|
cI = cI+1;
|
||||||
|
end
|
||||||
|
elseif s == 3
|
||||||
|
if fuoriSoglia2(n,1) == 1 || fuoriSoglia2(n,2) == 1 || fuoriSoglia2(n,4) == 1
|
||||||
|
alarm = 1;
|
||||||
|
indexALA(cI,1) = n; % Data
|
||||||
|
indexALA(cI,2) = s; % sensore
|
||||||
|
cI = cI+1;
|
||||||
|
end
|
||||||
|
elseif s == 4
|
||||||
|
if fuoriSoglia2(n,1) == 1 || fuoriSoglia2(n,2) == 1 || fuoriSoglia2(n,3) == 1
|
||||||
|
alarm = 1;
|
||||||
|
indexALA(cI,1) = n; % Data
|
||||||
|
indexALA(cI,2) = s; % sensore
|
||||||
|
cI = cI+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if fuoriSoglia4(n,s) == 1
|
||||||
|
alert = 1;
|
||||||
|
indexALE(cI2,1) = n; % Data
|
||||||
|
indexALE(cI2,2) = s; % sensore
|
||||||
|
cI2 = cI2+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if alert == 1 || alarm == 1
|
||||||
|
|
||||||
|
%% Controllo la data
|
||||||
|
if alarm == 1
|
||||||
|
if strcmp(IDcentralina,'ID0081') && strcmp(DTcatena,'DT0009') % Varazze - Casanova - Via Fossello
|
||||||
|
dateALA = ARRAYdate_LL(indexALA(:,1));
|
||||||
|
nodeALA = NodoLoadLink(indexALA(:,2),2);
|
||||||
|
valALA = round(DatiLoad(indexALA(:,1),indexALA(:,2)),2);
|
||||||
|
desc = 'kN';
|
||||||
|
sms = 1;
|
||||||
|
elseif strcmp(IDcentralina,'ID0082') && strcmp(DTcatena,'DT0010') % Riva di Tures
|
||||||
|
dateALA = ARRAYdate_CrL(indexALA(:,1));
|
||||||
|
nodeALA = NodoCrackLink(indexALA(:,2),2);
|
||||||
|
valALA = round(DatiCrack(indexALA(:,1),indexALA(:,2)),2);
|
||||||
|
desc = 'mm';
|
||||||
|
sms = 1;
|
||||||
|
end
|
||||||
|
DataALA = dateALA(end);
|
||||||
|
end
|
||||||
|
if alert == 1
|
||||||
|
if strcmp(IDcentralina,'ID0081') && strcmp(DTcatena,'DT0009') % Varazze - Casanova - Via Fossello
|
||||||
|
dateALE = ARRAYdate_LL(indexALE(:,1));
|
||||||
|
nodeALE = NodoLoadLink(indexALE(:,2),2);
|
||||||
|
valALE = round(DatiLoad(indexALA(:,1),indexALA(:,2)),2);
|
||||||
|
desc = 'kN';
|
||||||
|
sms = 0;
|
||||||
|
elseif strcmp(IDcentralina,'ID0082') && strcmp(DTcatena,'DT0010') % Riva di Tures
|
||||||
|
dateALE = ARRAYdate_CrL(indexALE(:,1));
|
||||||
|
nodeALE = NodoCrackLink(indexALE(:,2),2);
|
||||||
|
valALE = round(DatiCrack(indexALA(:,1),indexALA(:,2)),2);
|
||||||
|
desc = 'mm';
|
||||||
|
sms = 0;
|
||||||
|
end
|
||||||
|
DataALE = dateALE(end);
|
||||||
|
end
|
||||||
|
|
||||||
|
FileNameALA = ['' IDcentralina '-' DTcatena '-Alarm.txt'];
|
||||||
|
if isfile(FileNameALA) == 1
|
||||||
|
A = importdata(FileNameALA);
|
||||||
|
[rA,~] = size(A);
|
||||||
|
if rA == 0
|
||||||
|
DataRifALE = 0;
|
||||||
|
DataRifALA = 0;
|
||||||
|
elseif rA == 1
|
||||||
|
DataRifALA = A(1,1);
|
||||||
|
DataRifALE = 0;
|
||||||
|
else
|
||||||
|
DataRifALA = A(1,1);
|
||||||
|
DataRifALE = A(2,1);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DataRifALE = 0;
|
||||||
|
DataRifALA = 0;
|
||||||
|
end
|
||||||
|
DATA_rif = max(DataRifALA,DataRifALE); % Data della mail
|
||||||
|
|
||||||
|
if alert == 1 || alarm == 1
|
||||||
|
if alert == 1 && alarm == 1
|
||||||
|
DATA = max(DataALA,DataALE);
|
||||||
|
DataWriteALA = DataALA;
|
||||||
|
DataWriteALE = DataALE;
|
||||||
|
elseif alert == 1
|
||||||
|
DATA = DataALE;
|
||||||
|
DataWriteALE = DataALE;
|
||||||
|
DataWriteALA = DataRifALA;
|
||||||
|
elseif alarm == 1
|
||||||
|
DATA = DataALA;
|
||||||
|
DataWriteALA = DataALA;
|
||||||
|
DataWriteALE = DataRifALE;
|
||||||
|
end
|
||||||
|
|
||||||
|
if DATA_rif >= DATA % Mail già inviata
|
||||||
|
Mail = 0;
|
||||||
|
else
|
||||||
|
Mail = 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DataWriteALA = DataRifALA;
|
||||||
|
DataWriteALE = DataRifALE;
|
||||||
|
end
|
||||||
|
|
||||||
|
if Mail == 1
|
||||||
|
allarme = 0;
|
||||||
|
DATAinsert = cell(1,9);
|
||||||
|
AL = 1;
|
||||||
|
for ii = 1:cI-1 % numero di allarmi
|
||||||
|
if DATA_rif < dateALA(ii) % Allarme non ancora uscito
|
||||||
|
Data = datestr(dateALA(ii),'yyyy-mm-dd HH:MM:SS');
|
||||||
|
Valore = valALA(ii);
|
||||||
|
Nodo = cell2mat(nodeALA(ii));
|
||||||
|
Livello = 2;
|
||||||
|
DATAinsert{AL,1} = 3; % Soglie tradizionali
|
||||||
|
DATAinsert{AL,2} = IDcentralina;
|
||||||
|
DATAinsert{AL,3} = DTcatena;
|
||||||
|
DATAinsert{AL,4} = Nodo;
|
||||||
|
DATAinsert{AL,5} = Data;
|
||||||
|
DATAinsert{AL,6} = Valore;
|
||||||
|
DATAinsert{AL,7} = Livello;
|
||||||
|
DATAinsert{AL,8} = sms;
|
||||||
|
DATAinsert{AL,9} = desc;
|
||||||
|
allarme = 1;
|
||||||
|
AL = AL+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for ii = 1:cI2-1 % numero di allerte
|
||||||
|
if DATA_rif < dateALE(ii) % Allerta non ancora uscita
|
||||||
|
Data = datestr(dateALE(ii),'yyyy-mm-dd HH:MM:SS');
|
||||||
|
Valore = valALE(ii);
|
||||||
|
Nodo = cell2mat(nodeALE(ii));
|
||||||
|
Livello = 1;
|
||||||
|
DATAinsert{AL,1} = 3; % Soglie tradizionali
|
||||||
|
DATAinsert{AL,2} = IDcentralina;
|
||||||
|
DATAinsert{AL,3} = DTcatena;
|
||||||
|
DATAinsert{AL,4} = Nodo;
|
||||||
|
DATAinsert{AL,5} = Data;
|
||||||
|
DATAinsert{AL,6} = Valore;
|
||||||
|
DATAinsert{AL,7} = Livello;
|
||||||
|
DATAinsert{AL,8} = sms;
|
||||||
|
DATAinsert{AL,9} = desc;
|
||||||
|
allarme = 1;
|
||||||
|
AL = AL+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if allarme == 1
|
||||||
|
AL = AL-1; % Numero totale di allarmi
|
||||||
|
for a = 1:AL
|
||||||
|
% Cerco se il dato è già presente
|
||||||
|
Data = DATAinsert{a,5};
|
||||||
|
nNodo = num2str(DATAinsert{a,4}); % Numero nodo
|
||||||
|
type = num2str(DATAinsert{a,1}); % tipologia
|
||||||
|
level = num2str(DATAinsert{a,7}); % livello allarme
|
||||||
|
value = num2str(DATAinsert{a,6}); % Valore
|
||||||
|
desc = DATAinsert{a,9}; % Descrizione
|
||||||
|
comando = ['select id, type_id, date_time from alarms where unit_name = ''' ...
|
||||||
|
IDcentralina ''' and tool_name = ''' DTcatena ''' and node_num = ''' ...
|
||||||
|
nNodo ''' and date_time = ''' Data ''' and type_id = ''' type ...
|
||||||
|
''' and alarm_level = ''' level ''' and registered_value = ''' value ...
|
||||||
|
''' and description like ''' desc ''' order by date_time'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
idDate = curs.Data;
|
||||||
|
if idDate == 0 || strcmp(idDate,'No Data') == 1
|
||||||
|
idElabData = 0; % 0 indica che il dato non è presente su DB
|
||||||
|
else
|
||||||
|
idElabData = cell2mat(idDate(:,1));
|
||||||
|
end
|
||||||
|
tablename = 'alarms';
|
||||||
|
colnames = {'type_id','unit_name','tool_name','node_num','date_time',...
|
||||||
|
'registered_value','alarm_level','send_sms','description'};
|
||||||
|
data = [DATAinsert(a,1),DATAinsert(a,2),DATAinsert(a,3),DATAinsert(a,4),...
|
||||||
|
DATAinsert(a,5),DATAinsert(a,6),DATAinsert(a,7),DATAinsert(a,8),DATAinsert(a,9)];
|
||||||
|
if idElabData == 0 % Scrivo
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
fileID = fopen(FileNameALA,'a');
|
||||||
|
outdat = fopen(FileNameALA,'wt+');
|
||||||
|
fmt = '%.10f \r';
|
||||||
|
fprintf(fileID,fmt,DataWriteALA);
|
||||||
|
fmt = '%.10f \r';
|
||||||
|
fprintf(fileID,fmt,DataWriteALE);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text = ('alert_Levels function worked correctly');
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
68
ATD/approx_PCL.m
Executable file
68
ATD/approx_PCL.m
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
% Funzione che approssima il dato alla quarta cifra decimale (decimi di
|
||||||
|
% millimetri)
|
||||||
|
function [Y_PCL,Z_PCL,Ylocal_PCL,Zlocal_PCL,TempDef_PCL,speed_PCL,...
|
||||||
|
speed_local_PCL,acceleration_PCL,acceleration_local_PCL,AlfaX_PCL,AlfaY_PCL] = ...
|
||||||
|
approx_PCL(Y_PCL,Z_PCL,Ylocal_PCL,Zlocal_PCL,TempDef_PCL,speed_PCL,speed_local_PCL,...
|
||||||
|
acceleration_PCL,acceleration_local_PCL,AlfaX_PCL,AlfaY_PCL,FileName)
|
||||||
|
|
||||||
|
text = 'approx_PCL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% Y
|
||||||
|
conv = Y_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Y_PCL = conv/10000;
|
||||||
|
|
||||||
|
% Y local
|
||||||
|
conv = Ylocal_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Ylocal_PCL = conv/10000;
|
||||||
|
|
||||||
|
% Z
|
||||||
|
conv = Z_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Z_PCL = conv/10000;
|
||||||
|
|
||||||
|
% Z local
|
||||||
|
conv = Zlocal_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Zlocal_PCL = conv/10000;
|
||||||
|
|
||||||
|
% TempDef
|
||||||
|
conv = TempDef_PCL*10;
|
||||||
|
conv = round(conv);
|
||||||
|
TempDef_PCL = conv/10;
|
||||||
|
|
||||||
|
% Accelerazione
|
||||||
|
conv = acceleration_local_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
acceleration_local_PCL = conv/10000;
|
||||||
|
|
||||||
|
conv = acceleration_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
acceleration_PCL = conv/10000;
|
||||||
|
|
||||||
|
% Velocità
|
||||||
|
conv = speed_local_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
speed_local_PCL = conv/10000;
|
||||||
|
|
||||||
|
conv = speed_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
speed_PCL = conv/10000;
|
||||||
|
|
||||||
|
% Angoli
|
||||||
|
conv = AlfaY_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
AlfaY_PCL = conv/10000;
|
||||||
|
|
||||||
|
conv = AlfaY_PCL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
AlfaY_PCL = conv/10000;
|
||||||
|
|
||||||
|
text = 'approx_PCL function executed correctly. approx_PCL function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
49
ATD/approx_RL.m
Executable file
49
ATD/approx_RL.m
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
% Funzione che approssima il dato alla quarta cifra decimale (decimi di
|
||||||
|
% millimetri)
|
||||||
|
function [X_RL,Y_RL,Z_RL,Xlocal_RL,Ylocal_RL,Zlocal_RL,TempDef_RL] = ...
|
||||||
|
approx_RL(X_RL,Y_RL,Z_RL,Xlocal_RL,Ylocal_RL,Zlocal_RL,TempDef_RL,FileName)
|
||||||
|
|
||||||
|
text = 'approx_RL function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% X
|
||||||
|
conv = X_RL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
X_RL = conv/10000;
|
||||||
|
|
||||||
|
% X local
|
||||||
|
conv = Xlocal_RL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Xlocal_RL = conv/10000;
|
||||||
|
|
||||||
|
% Y
|
||||||
|
conv = Y_RL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Y_RL = conv/10000;
|
||||||
|
|
||||||
|
% Y local
|
||||||
|
conv = Ylocal_RL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Ylocal_RL = conv/10000;
|
||||||
|
|
||||||
|
% Z
|
||||||
|
conv = Z_RL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Z_RL = conv/10000;
|
||||||
|
|
||||||
|
% Z local
|
||||||
|
conv = Zlocal_RL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Zlocal_RL = conv/10000;
|
||||||
|
|
||||||
|
% TempDef
|
||||||
|
conv = TempDef_RL*10;
|
||||||
|
conv = round(conv);
|
||||||
|
TempDef_RL = conv/10;
|
||||||
|
|
||||||
|
text = 'approx_RL function worked correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
68
ATD/approx_TLH.m
Executable file
68
ATD/approx_TLH.m
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
% Funzione che approssima il dato alla quarta cifra decimale (decimi di
|
||||||
|
% millimetri)
|
||||||
|
function [Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,TempDef_TLH,speed_TLH,...
|
||||||
|
speed_local_TLH,acceleration_TLH,acceleration_local_TLH,AlfaX_TLH,AlfaY_TLH] = ...
|
||||||
|
approx_TLH(Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,TempDef_TLH,speed_TLH,speed_local_TLH,...
|
||||||
|
acceleration_TLH,acceleration_local_TLH,AlfaX_TLH,AlfaY_TLH,FileName)
|
||||||
|
|
||||||
|
text = 'approx_TLH function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% Y
|
||||||
|
conv = Y_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Y_TLH = conv/10000;
|
||||||
|
|
||||||
|
% Y local
|
||||||
|
conv = Ylocal_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Ylocal_TLH = conv/10000;
|
||||||
|
|
||||||
|
% Z
|
||||||
|
conv = Z_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Z_TLH = conv/10000;
|
||||||
|
|
||||||
|
% Z local
|
||||||
|
conv = Zlocal_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Zlocal_TLH = conv/10000;
|
||||||
|
|
||||||
|
% TempDef
|
||||||
|
conv = TempDef_TLH*10;
|
||||||
|
conv = round(conv);
|
||||||
|
TempDef_TLH = conv/10;
|
||||||
|
|
||||||
|
% Accelerazione
|
||||||
|
conv = acceleration_local_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
acceleration_local_TLH = conv/10000;
|
||||||
|
|
||||||
|
conv = acceleration_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
acceleration_TLH = conv/10000;
|
||||||
|
|
||||||
|
% Velocità
|
||||||
|
conv = speed_local_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
speed_local_TLH = conv/10000;
|
||||||
|
|
||||||
|
conv = speed_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
speed_TLH = conv/10000;
|
||||||
|
|
||||||
|
% Angoli
|
||||||
|
conv = AlfaY_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
AlfaY_TLH = conv/10000;
|
||||||
|
|
||||||
|
conv = AlfaY_TLH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
AlfaY_TLH = conv/10000;
|
||||||
|
|
||||||
|
text = 'approx_TLH function executed correctly. approx_TLH function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
69
ATD/approx_TLHRH.m
Executable file
69
ATD/approx_TLHRH.m
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
% Funzione che approssima il dato alla quarta cifra decimale (decimi di
|
||||||
|
% millimetri)
|
||||||
|
function [Y_TLHRH,Z_TLHRH,Ylocal_TLHRH,Zlocal_TLHRH,TempDef_TLHRH,speed_TLHRH,...
|
||||||
|
speed_local_TLHRH,acceleration_TLHRH,acceleration_local_TLHRH,AlfaX_TLHRH,...
|
||||||
|
AlfaY_TLHRH] = approx_TLHRH(Y_TLHRH,Z_TLHRH,Ylocal_TLHRH,Zlocal_TLHRH,...
|
||||||
|
TempDef_TLHRH,speed_TLHRH,speed_local_TLHRH,acceleration_TLHRH,...
|
||||||
|
acceleration_local_TLHRH,AlfaX_TLHRH,AlfaY_TLHRH,FileName)
|
||||||
|
|
||||||
|
text = 'approx_TLHRH function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% Y
|
||||||
|
conv = Y_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Y_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
% Y local
|
||||||
|
conv = Ylocal_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Ylocal_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
% Z
|
||||||
|
conv = Z_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Z_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
% Z local
|
||||||
|
conv = Zlocal_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Zlocal_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
% TempDef
|
||||||
|
conv = TempDef_TLHRH*10;
|
||||||
|
conv = round(conv);
|
||||||
|
TempDef_TLHRH = conv/10;
|
||||||
|
|
||||||
|
% Accelerazione
|
||||||
|
conv = acceleration_local_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
acceleration_local_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
conv = acceleration_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
acceleration_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
% Velocità
|
||||||
|
conv = speed_local_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
speed_local_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
conv = speed_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
speed_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
% Angoli
|
||||||
|
conv = AlfaY_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
AlfaY_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
conv = AlfaY_TLHRH*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
AlfaY_TLHRH = conv/10000;
|
||||||
|
|
||||||
|
text = 'approx_TLHRH function executed correctly. approx_TLHRH function closed';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
87
ATD/approx_TuL.m
Executable file
87
ATD/approx_TuL.m
Executable file
@@ -0,0 +1,87 @@
|
|||||||
|
% Funzione che approssima il dato alla quarta cifra decimale (decimi di
|
||||||
|
% millimetri)
|
||||||
|
function [X_TuL,Y_TuL,Z_TuL,Xlocal_TuL,Ylocal_TuL,Zlocal_TuL,Xstar_TuL,Zstar_TuL,HShift_local_TuL,...
|
||||||
|
SegStar,TempDef_TuL,Speed_local_TuL,Acceleration_local_TuL,Area_TuL] = approx_TuL(X_TuL,...
|
||||||
|
Y_TuL,Z_TuL,Xlocal_TuL,Ylocal_TuL,Zlocal_TuL,Xstar_TuL,Zstar_TuL,HShift_local_TuL,...
|
||||||
|
SegStar,TempDef_TuL,Speed_local_TuL,Acceleration_local_TuL,Area_TuL,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'approx_TuL function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
% X
|
||||||
|
conv = X_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
X_TuL = conv/10000;
|
||||||
|
|
||||||
|
% X star
|
||||||
|
conv = Xstar_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Xstar_TuL = conv/10000;
|
||||||
|
|
||||||
|
% X local
|
||||||
|
conv = Xlocal_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Xlocal_TuL = conv/10000;
|
||||||
|
|
||||||
|
% Y
|
||||||
|
conv = Y_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Y_TuL = conv/10000;
|
||||||
|
|
||||||
|
% Y local
|
||||||
|
conv = Ylocal_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Ylocal_TuL = conv/10000;
|
||||||
|
|
||||||
|
% Z
|
||||||
|
conv = Z_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Z_TuL = conv/10000;
|
||||||
|
|
||||||
|
% Zstar
|
||||||
|
conv = Zstar_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Zstar_TuL = conv/10000;
|
||||||
|
|
||||||
|
% Z local
|
||||||
|
conv = Zlocal_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Zlocal_TuL = conv/10000;
|
||||||
|
|
||||||
|
% H Shift local
|
||||||
|
conv = HShift_local_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
HShift_local_TuL = conv/10000;
|
||||||
|
|
||||||
|
% SegStar
|
||||||
|
conv = SegStar*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
SegStar = conv/10000;
|
||||||
|
|
||||||
|
% TempDef
|
||||||
|
conv = TempDef_TuL*10;
|
||||||
|
conv = round(conv);
|
||||||
|
TempDef_TuL = conv/10;
|
||||||
|
|
||||||
|
% Speed
|
||||||
|
conv = Speed_local_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Speed_local_TuL = conv/10000;
|
||||||
|
|
||||||
|
% Acceleration
|
||||||
|
conv = Acceleration_local_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Acceleration_local_TuL = conv/10000;
|
||||||
|
|
||||||
|
% Area
|
||||||
|
conv = Area_TuL*10000;
|
||||||
|
conv = round(conv);
|
||||||
|
Area_TuL = conv/10000;
|
||||||
|
|
||||||
|
text = 'approx_TuL function worked correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
8
ATD/calibPCL.m
Executable file
8
ATD/calibPCL.m
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
function scarti = calibPCL(x,Temp,i,j,Parametro1,off,Zlocal,TempMod)
|
||||||
|
|
||||||
|
TempMod(Parametro1+off:j,i) = x(1)*Temp(Parametro1+off:j,i)+x(2);
|
||||||
|
sc = (TempMod(Parametro1+off:j,i)-Zlocal(Parametro1+off:j,i)).^2;
|
||||||
|
scarti = sum(sc);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
21
ATD/cancellaDB.m
Executable file
21
ATD/cancellaDB.m
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
function cancellaDB(IDcentralina,DTcatena,Data_scarico,FileName,conn)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
text = 'cancellaDB function started';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
comando = ['delete from ELABDATADISP where UnitName = ''' IDcentralina...
|
||||||
|
''' and ToolNameID = ''' DTcatena ''' and EventDate >= ''' Data_scarico ''' '];
|
||||||
|
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
|
||||||
|
text = strcat('Elaborated Data of Unit ', IDcentralina, ' Chain ',...
|
||||||
|
DTcatena,' deleted starting from date ',Data_scarico,' during the execution of LastElab function.');
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
text = 'cancellaDB function ended';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
22
ATD/cellMaker2DCrL.m
Executable file
22
ATD/cellMaker2DCrL.m
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
function DATAinsert = cellMaker2DCrL(IDcentralina,DTcatena,NodeNum,c2DCrL,ListaDate,...
|
||||||
|
ARRAYdate_2DCrL,Dati2DCrack,DatiNTCCrack2D,Err2DCrackLink,...
|
||||||
|
Ch2DCrL,CrL2D_NTC,cont2DCrL)
|
||||||
|
|
||||||
|
DATAinsert = cell(ListaDate,9);
|
||||||
|
for ii=1:ListaDate
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_2DCrL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_2DCrL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = Dati2DCrack(ii,c2DCrL);
|
||||||
|
DATAinsert{ii,7} = Dati2DCrack(ii,c2DCrL+1);
|
||||||
|
if Ch2DCrL(cont2DCrL) >= 3
|
||||||
|
if CrL2D_NTC(cont2DCrL) == 1
|
||||||
|
DATAinsert{ii,8} = DatiNTCCrack2D(ii,cont2DCrL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DATAinsert{ii,9} = Err2DCrackLink(ii,cont2DCrL);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
23
ATD/cellMaker3DCrL.m
Executable file
23
ATD/cellMaker3DCrL.m
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
function DATAinsert = cellMaker3DCrL(IDcentralina,DTcatena,NodeNum,c3DCrL,ListaDate,...
|
||||||
|
ARRAYdate_3DCrL,Dati3DCrack,DatiNTCCrack3D,Err3DCrackLink,...
|
||||||
|
Ch3DCrL,CrL3D_NTC,cont3DCrL)
|
||||||
|
|
||||||
|
DATAinsert = cell(ListaDate,10);
|
||||||
|
for ii=1:ListaDate
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_3DCrL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_3DCrL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = Dati3DCrack(ii,c3DCrL);
|
||||||
|
DATAinsert{ii,7} = Dati3DCrack(ii,c3DCrL+1);
|
||||||
|
DATAinsert{ii,8} = Dati3DCrack(ii,c3DCrL+2);
|
||||||
|
if Ch3DCrL(cont3DCrL) >= 4
|
||||||
|
if CrL3D_NTC(cont3DCrL) == 1
|
||||||
|
DATAinsert{ii,9} = DatiNTCCrack3D(ii,cont3DCrL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DATAinsert{ii,10} = Err3DCrackLink(ii,cont3DCrL);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
23
ATD/cellMaker3DEL.m
Executable file
23
ATD/cellMaker3DEL.m
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
function DATAinsert = cellMaker3DEL(IDcentralina,DTcatena,NodeNum,c3DEL,c3DEL_NTC,ListaDate,ARRAYdate_3DEL,...
|
||||||
|
DatiExtensometer3D,DatiNTCExtensometer3D,Err3DExtensometerLink,Ch3DEL,EL3D_NTC)
|
||||||
|
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,10);
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_3DEL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_3DEL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = DatiExtensometer3D(ii,c3DEL);
|
||||||
|
DATAinsert{ii,7} = DatiExtensometer3D(ii,c3DEL+1);
|
||||||
|
DATAinsert{ii,8} = DatiExtensometer3D(ii,c3DEL+2);
|
||||||
|
if Ch3DEL(c3DEL_NTC) == 4
|
||||||
|
if EL3D_NTC(c3DEL_NTC) == 1
|
||||||
|
DATAinsert{ii,9} = DatiNTCExtensometer3D(ii,c3DEL_NTC);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DATAinsert{ii,10} = Err3DExtensometerLink(ii,c3DEL_NTC);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
20
ATD/cellMakerCrL.m
Executable file
20
ATD/cellMakerCrL.m
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
function DATAinsert = cellMakerCrL(IDcentralina,DTcatena,NodeNum,cCrL,ListaDate,...
|
||||||
|
ARRAYdate_CrL,DatiCrack,DatiNTCCrack,ChCrL,CrL_NTC,ErrCrackLink)
|
||||||
|
|
||||||
|
DATAinsert = cell(ListaDate,8);
|
||||||
|
for ii=1:ListaDate
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_CrL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_CrL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = DatiCrack(ii,cCrL);
|
||||||
|
if ChCrL(cCrL) >= 2
|
||||||
|
if CrL_NTC(cCrL) == 1
|
||||||
|
DATAinsert{ii,7} = DatiNTCCrack(ii,cCrL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DATAinsert{ii,8} = ErrCrackLink(ii,cCrL);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
25
ATD/cellMakerEL.m
Executable file
25
ATD/cellMakerEL.m
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
function DATAinsert = cellMakerEL(IDcentralina,DTcatena,NodeNum,cEL,ListaDate,ARRAYdate_EL,...
|
||||||
|
DatiExtensometer,DatiNTCExtensometer,Carico_ass,Sforzo,Calcolo_Carico,ErrExtensometerLink,ChEL,EL_NTC)
|
||||||
|
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,8);
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_EL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_EL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = DatiExtensometer(ii,cEL);
|
||||||
|
if ChEL(cEL) >= 2
|
||||||
|
if EL_NTC(cEL) == 1
|
||||||
|
DATAinsert{ii,7} = DatiNTCExtensometer(ii,cEL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DATAinsert{ii,8} = ErrExtensometerLink(ii,cEL);
|
||||||
|
if Calcolo_Carico == 1
|
||||||
|
DATAinsert{ii,9} = Carico_ass(ii,cEL);
|
||||||
|
DATAinsert{ii,10} = Sforzo(ii,cEL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
16
ATD/cellMakerLL.m
Executable file
16
ATD/cellMakerLL.m
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
function DATAinsert = cellMakerLL(IDcentralina,DTcatena,NodeNum,...
|
||||||
|
cLL,ListaDate,ARRAYdateLL,DatiLoad,ErrLoadLink)
|
||||||
|
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,7);
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdateLL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdateLL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = DatiLoad(ii,cLL);
|
||||||
|
DATAinsert{ii,7} = ErrLoadLink(ii,cLL);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
40
ATD/cellMakerMPBEL.m
Executable file
40
ATD/cellMakerMPBEL.m
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
function DATAinsert = cellMakerMPBEL(IDcentralina,DTcatena,NodeNum,cMPBEL,contMPBEL,...
|
||||||
|
ListaDate,ARRAYdate_MPBEL,DatiMultiBase,NumBasi,ErrMultiPointExtensometer)
|
||||||
|
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,11);
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_MPBEL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_MPBEL(ii),'HH:MM:SS');
|
||||||
|
if NumBasi == 1
|
||||||
|
DATAinsert{ii,6} = DatiMultiBase(ii,cMPBEL);
|
||||||
|
DATAinsert{ii,7} = ErrMultiPointExtensometer(ii,contMPBEL);
|
||||||
|
elseif NumBasi == 2
|
||||||
|
DATAinsert{ii,6} = DatiMultiBase(ii,cMPBEL);
|
||||||
|
DATAinsert{ii,7} = DatiMultiBase(ii,cMPBEL+1);
|
||||||
|
DATAinsert{ii,8} = ErrMultiPointExtensometer(ii,contMPBEL);
|
||||||
|
elseif NumBasi == 3
|
||||||
|
DATAinsert{ii,6} = DatiMultiBase(ii,cMPBEL);
|
||||||
|
DATAinsert{ii,7} = DatiMultiBase(ii,cMPBEL+1);
|
||||||
|
DATAinsert{ii,8} = DatiMultiBase(ii,cMPBEL+2);
|
||||||
|
DATAinsert{ii,9} = ErrMultiPointExtensometer(ii,contMPBEL);
|
||||||
|
elseif NumBasi == 4
|
||||||
|
DATAinsert{ii,6} = DatiMultiBase(ii,cMPBEL);
|
||||||
|
DATAinsert{ii,7} = DatiMultiBase(ii,cMPBEL+1);
|
||||||
|
DATAinsert{ii,8} = DatiMultiBase(ii,cMPBEL+2);
|
||||||
|
DATAinsert{ii,9} = DatiMultiBase(ii,cMPBEL+3);
|
||||||
|
DATAinsert{ii,10} = ErrMultiPointExtensometer(ii,contMPBEL);
|
||||||
|
elseif NumBasi == 5
|
||||||
|
DATAinsert{ii,6} = DatiMultiBase(ii,cMPBEL);
|
||||||
|
DATAinsert{ii,7} = DatiMultiBase(ii,cMPBEL+1);
|
||||||
|
DATAinsert{ii,8} = DatiMultiBase(ii,cMPBEL+2);
|
||||||
|
DATAinsert{ii,9} = DatiMultiBase(ii,cMPBEL+3);
|
||||||
|
DATAinsert{ii,10} = DatiMultiBase(ii,cMPBEL+4);
|
||||||
|
DATAinsert{ii,11} = ErrMultiPointExtensometer(ii,contMPBEL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
30
ATD/cellMakerPCL.m
Executable file
30
ATD/cellMakerPCL.m
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
% Creo la matrice che scriverň su DB
|
||||||
|
function DATAinsert = cellMakerPCL(IDcentralina,DTcatena,NodeNum,cPCL,ListaDate,...
|
||||||
|
Y_PCL,Z_PCL,Ylocal_PCL,Zlocal_PCL,AlfaX_PCL,AlfaY_PCL,TempDef_PCL,speed_PCL,...
|
||||||
|
speed_local_PCL,acceleration_PCL,acceleration_local_PCL,ErrPreConvLink,ARRAYdate_PCL)
|
||||||
|
|
||||||
|
TempDef_PCL = TempDef_PCL';
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,17);
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_PCL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_PCL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = Y_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,7} = Z_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,8} = Ylocal_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,9} = Zlocal_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,10} = AlfaX_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,11} = AlfaY_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,12} = TempDef_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,13} = speed_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,14} = speed_local_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,15} = acceleration_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,16} = acceleration_local_PCL(cPCL,ii);
|
||||||
|
DATAinsert{ii,17} = ErrPreConvLink(cPCL,ii);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
31
ATD/cellMakerPCLHR.m
Executable file
31
ATD/cellMakerPCLHR.m
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
% Creo la matrice che scriverň su DB
|
||||||
|
function DATAinsert = cellMakerPCLHR(IDcentralina,DTcatena,NodeNum,cPCLHR,ListaDate,...
|
||||||
|
Y_PCLHR,Z_PCLHR,Ylocal_PCLHR,Zlocal_PCLHR,AlfaX_PCLHR,AlfaY_PCLHR,TempDef_PCLHR,...
|
||||||
|
speed_PCLHR,speed_local_PCLHR,acceleration_PCLHR,acceleration_local_PCLHR,...
|
||||||
|
ErrPreConvLinkHR,ARRAYdate_PCLHR)
|
||||||
|
|
||||||
|
TempDef_PCLHR = TempDef_PCLHR';
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,17);
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_PCLHR(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_PCLHR(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = Y_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,7} = Z_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,8} = Ylocal_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,9} = Zlocal_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,10} = AlfaX_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,11} = AlfaY_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,12} = TempDef_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,13} = speed_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,14} = speed_local_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,15} = acceleration_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,16} = acceleration_local_PCLHR(cPCLHR,ii);
|
||||||
|
DATAinsert{ii,17} = ErrPreConvLinkHR(cPCLHR,ii);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
16
ATD/cellMakerPL.m
Executable file
16
ATD/cellMakerPL.m
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
function DATAinsert = cellMakerPL(IDcentralina,DTcatena,NodeNum,cPL,ListaDate,...
|
||||||
|
ARRAYdate_PL,DatiPressure,ErrPressureLink)
|
||||||
|
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,7);
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_PL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_PL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = DatiPressure(ii,cPL);
|
||||||
|
DATAinsert{ii,7} = ErrPressureLink(ii,cPL);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
26
ATD/cellMakerRL.m
Executable file
26
ATD/cellMakerRL.m
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
% Creo la matrice che scriverň su DB
|
||||||
|
function DATAinsert = cellMakerRL(IDcentralina,DTcatena,NodeNum,cRL,ListaDate,ARRAYdate_RL,...
|
||||||
|
X_RL,Y_RL,Z_RL,Xlocal_RL,Ylocal_RL,Zlocal_RL,TempDef_RL,ErrRadialLink)
|
||||||
|
|
||||||
|
TempDef_RL = TempDef_RL';
|
||||||
|
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,13);
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_RL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_RL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = X_RL(cRL,ii);
|
||||||
|
DATAinsert{ii,7} = Y_RL(cRL,ii);
|
||||||
|
DATAinsert{ii,8} = Z_RL(cRL,ii);
|
||||||
|
DATAinsert{ii,9} = Xlocal_RL(cRL,ii);
|
||||||
|
DATAinsert{ii,10} = Ylocal_RL(cRL,ii);
|
||||||
|
DATAinsert{ii,11} = Zlocal_RL(cRL,ii);
|
||||||
|
DATAinsert{ii,12} = TempDef_RL(cRL,ii);
|
||||||
|
DATAinsert{ii,13} = ErrRadialLink(cRL,ii);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
20
ATD/cellMakerSM.m
Executable file
20
ATD/cellMakerSM.m
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
function DATAinsert = cellMakerSM(IDcentralina,DTcatena,NodeNum,cSM,ListaDate,...
|
||||||
|
ARRAYdate_SM,DatiStress,DatiNTCStress,ChSM,SM_NTC,ErrStressMeter)
|
||||||
|
|
||||||
|
DATAinsert = cell(ListaDate,8);
|
||||||
|
for ii=1:ListaDate
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_SM(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_SM(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = DatiStress(ii,cSM);
|
||||||
|
if ChSM(cSM) >= 2
|
||||||
|
if SM_NTC(cSM) == 1
|
||||||
|
DATAinsert{ii,7} = DatiNTCStress(ii,cSM);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DATAinsert{ii,8} = ErrStressMeter(ii,cSM);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
30
ATD/cellMakerTLH.m
Executable file
30
ATD/cellMakerTLH.m
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
% Creo la matrice che scriverň su DB
|
||||||
|
function DATAinsert = cellMakerTLH(IDcentralina,DTcatena,NodeNum,cTLH,ListaDate,...
|
||||||
|
Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,AlfaX_TLH,AlfaY_TLH,TempDef_TLH,speed_TLH,...
|
||||||
|
speed_local_TLH,acceleration_TLH,acceleration_local_TLH,ErrTiltLinkH,ARRAYdate_TLH)
|
||||||
|
|
||||||
|
TempDef_TLH = TempDef_TLH';
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,17);
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_TLH(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_TLH(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = Y_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,7} = Z_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,8} = Ylocal_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,9} = Zlocal_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,10} = AlfaX_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,11} = AlfaY_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,12} = TempDef_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,13} = speed_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,14} = speed_local_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,15} = acceleration_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,16} = acceleration_local_TLH(cTLH,ii);
|
||||||
|
DATAinsert{ii,17} = ErrTiltLinkH(cTLH,ii);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
31
ATD/cellMakerTLHRH.m
Executable file
31
ATD/cellMakerTLHRH.m
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
% Creo la matrice che scriverň su DB
|
||||||
|
function DATAinsert = cellMakerTLHRH(IDcentralina,DTcatena,NodeNum,cTLHRH,ListaDate,...
|
||||||
|
Y_TLHRH,Z_TLHRH,Ylocal_TLHRH,Zlocal_TLHRH,AlfaX_TLHRH,AlfaY_TLHRH,TempDef_TLHRH,...
|
||||||
|
speed_TLHRH,speed_local_TLHRH,acceleration_TLHRH,acceleration_local_TLHRH,...
|
||||||
|
ErrTiltLinkHRH,ARRAYdate_TLHRH)
|
||||||
|
|
||||||
|
TempDef_TLHRH = TempDef_TLHRH';
|
||||||
|
l = ListaDate;
|
||||||
|
DATAinsert = cell(l,17);
|
||||||
|
|
||||||
|
for ii=1:l
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_TLHRH(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_TLHRH(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = Y_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,7} = Z_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,8} = Ylocal_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,9} = Zlocal_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,10} = AlfaX_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,11} = AlfaY_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,12} = TempDef_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,13} = speed_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,14} = speed_local_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,15} = acceleration_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,16} = acceleration_local_TLHRH(cTLHRH,ii);
|
||||||
|
DATAinsert{ii,17} = ErrTiltLinkHRH(cTLHRH,ii);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
44
ATD/cellMakerTuL.m
Executable file
44
ATD/cellMakerTuL.m
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
% Creo la matrice che scriverň su DB
|
||||||
|
function DATAinsert = cellMakerTuL(IDcentralina,DTcatena,NodeNum,cTuL,...
|
||||||
|
ListaDate,ARRAYdate_TuL,X_TuL,Xstar_TuL,Y_TuL,Z_TuL,Zstar_TuL,Xlocal_TuL,...
|
||||||
|
Ylocal_TuL,Zlocal_TuL,SegStar,HShift_local_TuL,TempDef_TuL,Area_TuL,...
|
||||||
|
Speed_local_TuL,Acceleration_local_TuL,ErrTunnelLink)
|
||||||
|
|
||||||
|
TempDef_TuL = TempDef_TuL';
|
||||||
|
|
||||||
|
l = ListaDate;
|
||||||
|
[r,~] = size(SegStar);
|
||||||
|
|
||||||
|
ini = 1;
|
||||||
|
DATAinsert = cell(l,20);
|
||||||
|
|
||||||
|
jj = 1;
|
||||||
|
for ii=ini:l
|
||||||
|
DATAinsert{jj,1} = IDcentralina;
|
||||||
|
DATAinsert{jj,2} = DTcatena;
|
||||||
|
DATAinsert{jj,3} = NodeNum;
|
||||||
|
DATAinsert{jj,4} = datestr(ARRAYdate_TuL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{jj,5} = datestr(ARRAYdate_TuL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{jj,6} = X_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,7} = Xstar_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,8} = Y_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,9} = Z_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,10} = Zstar_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,11} = Xlocal_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,12} = Ylocal_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,13} = Zlocal_TuL(cTuL,ii);
|
||||||
|
if cTuL > r % sono finiti i segmenti della stella
|
||||||
|
DATAinsert{jj,14} = 0;
|
||||||
|
else
|
||||||
|
DATAinsert{jj,14} = SegStar(cTuL,ii);
|
||||||
|
end
|
||||||
|
DATAinsert{jj,15} = HShift_local_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,16} = TempDef_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,17} = Speed_local_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,18} = Acceleration_local_TuL(cTuL,ii);
|
||||||
|
DATAinsert{jj,19} = Area_TuL(1,ii);
|
||||||
|
DATAinsert{jj,20} = ErrTunnelLink(cTuL,ii);
|
||||||
|
jj = jj+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
21
ATD/cellMakerWEL.m
Executable file
21
ATD/cellMakerWEL.m
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
function DATAinsert = cellMakerWEL(IDcentralina,DTcatena,NodeNum,cWEL,ListaDate,...
|
||||||
|
ARRAYdate_WEL,DatiWireExtensometer,DatiNTCWireExtensometer,ChWEL,WEL_NTC,...
|
||||||
|
ErrWireExtensometerLink)
|
||||||
|
|
||||||
|
DATAinsert = cell(ListaDate,8);
|
||||||
|
for ii=1:ListaDate
|
||||||
|
DATAinsert{ii,1} = IDcentralina;
|
||||||
|
DATAinsert{ii,2} = DTcatena;
|
||||||
|
DATAinsert{ii,3} = NodeNum;
|
||||||
|
DATAinsert{ii,4} = datestr(ARRAYdate_WEL(ii),'yyyy-mm-dd');
|
||||||
|
DATAinsert{ii,5} = datestr(ARRAYdate_WEL(ii),'HH:MM:SS');
|
||||||
|
DATAinsert{ii,6} = DatiWireExtensometer(ii,cWEL);
|
||||||
|
if ChWEL(cWEL) >= 2
|
||||||
|
if WEL_NTC(cWEL) == 1
|
||||||
|
DATAinsert{ii,7} = DatiNTCWireExtensometer(ii,cWEL);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
DATAinsert{ii,8} = ErrWireExtensometerLink(ii,cWEL);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
36
ATD/centralina.m
Executable file
36
ATD/centralina.m
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
function Unit = centralina(IDcentralina,conn,FileName)
|
||||||
|
|
||||||
|
text = 'centralina function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
|
||||||
|
comando = ['select type_id from units where name = ''' IDcentralina ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Type = cell2mat(curs.Data);
|
||||||
|
if Type == 1
|
||||||
|
Unit = 'G801';
|
||||||
|
elseif Type == 2
|
||||||
|
Unit = 'G802';
|
||||||
|
elseif Type == 3
|
||||||
|
Unit = 'G201';
|
||||||
|
elseif Type == 4
|
||||||
|
Unit = 'G301';
|
||||||
|
elseif Type == 5
|
||||||
|
Unit = 'D2W';
|
||||||
|
elseif Type == 6
|
||||||
|
Unit = 'GFLOW';
|
||||||
|
elseif Type == 7
|
||||||
|
Unit = 'Nesa';
|
||||||
|
elseif Type == 8
|
||||||
|
Unit = 'MUSA';
|
||||||
|
elseif Type == 9
|
||||||
|
Unit = 'Nesa evolution';
|
||||||
|
elseif Type == 10
|
||||||
|
Unit = 'CRX1000';
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'centralina function executed correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
91
ATD/centralina_Dati.m
Executable file
91
ATD/centralina_Dati.m
Executable file
@@ -0,0 +1,91 @@
|
|||||||
|
function [DATA,Tcentralina] = centralina(IDcentralina,DTcatena,catena,datainiTuL,tempoiniTuL,...
|
||||||
|
datainiRL,tempoiniRL,datainiTLH,tempoiniTLH,datainiTLHRH,tempoiniTLHRH,...
|
||||||
|
datainiPCL,tempoiniPCL,datainiPCLHR,tempoiniPCLHR,datainiLL,tempoiniLL,datainiPrL,...
|
||||||
|
tempoiniPrL,datainiEL,tempoiniEL,dataini3DEL,tempoini3DEL,datainiWEL,tempoiniWEL,...
|
||||||
|
datainiCrL,tempoiniCrL,dataini3DCrL,tempoini3DCrL,datainiMPBEL,tempoiniMPBEL,conn)
|
||||||
|
|
||||||
|
%% Temperatura
|
||||||
|
% cerco la temperatura nel primo nodo
|
||||||
|
i = 1;
|
||||||
|
z = 0;
|
||||||
|
while z==0
|
||||||
|
if cell2mat(catena(i,3)) == 1
|
||||||
|
z = 1;
|
||||||
|
else
|
||||||
|
i = i+1; % nodo numero 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
i = cell2mat(catena(i,1));
|
||||||
|
if i == 17
|
||||||
|
dataini = datainiTuL;
|
||||||
|
tempoini = tempoiniTuL;
|
||||||
|
elseif i == 21
|
||||||
|
dataini = datainiPrL;
|
||||||
|
tempoini = tempoiniPrL;
|
||||||
|
elseif i == 16
|
||||||
|
dataini = datainiEL;
|
||||||
|
tempoini = tempoiniEL;
|
||||||
|
elseif i == 19
|
||||||
|
dataini = dataini3DEL;
|
||||||
|
tempoini = tempoini3DEL;
|
||||||
|
elseif i == 23
|
||||||
|
dataini = datainiPCL;
|
||||||
|
tempoini = tempoiniPCL;
|
||||||
|
elseif i == 18
|
||||||
|
dataini = datainiRL;
|
||||||
|
tempoini = tempoiniRL;
|
||||||
|
elseif i == 11
|
||||||
|
dataini = datainiTLH;
|
||||||
|
tempoini = tempoiniTLH;
|
||||||
|
elseif i == 12
|
||||||
|
dataini = datainiTLHRH;
|
||||||
|
tempoini = tempoiniTLHRH;
|
||||||
|
elseif i == 15
|
||||||
|
dataini = datainiLL;
|
||||||
|
tempoini = tempoiniLL;
|
||||||
|
elseif i == 24
|
||||||
|
dataini = datainiPCLHR;
|
||||||
|
tempoini = tempoiniPCLHR;
|
||||||
|
elseif i == 22
|
||||||
|
dataini = datainiWEL;
|
||||||
|
tempoini = tempoiniWEL;
|
||||||
|
elseif i == 36
|
||||||
|
dataini = datainiCrL;
|
||||||
|
tempoini = tempoiniCrL;
|
||||||
|
elseif i == 37
|
||||||
|
dataini = dataini3DCrL;
|
||||||
|
tempoini = tempoini3DCrL;
|
||||||
|
elseif i == 25
|
||||||
|
dataini = datainiMPBEL;
|
||||||
|
tempoini = tempoiniMPBEL;
|
||||||
|
end
|
||||||
|
|
||||||
|
NodeNum = '1';
|
||||||
|
comando = ['select Date, Time, Temperature from RawDataView where Date = ''' ...
|
||||||
|
dataini ''' and Time >= ''' tempoini ''' and ToolNameID = ''' DTcatena...
|
||||||
|
''' and UnitName = ''' IDcentralina ''' and NodeNum = ''' NodeNum ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
BatTempo = curs.Data;
|
||||||
|
comando = ['select Date, Time, Temperature from RawDataView where Date > ''' ...
|
||||||
|
dataini ''' and ToolNameID = ''' DTcatena...
|
||||||
|
''' and UnitName = ''' IDcentralina ''' and NodeNum = ''' NodeNum ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
BatData = curs.Data;
|
||||||
|
if strcmp(char(BatData(1)),'No Data')
|
||||||
|
Tcentralina = BatTempo;
|
||||||
|
elseif strcmp(char(BatTempo(1)),'No Data')
|
||||||
|
Tcentralina = BatData;
|
||||||
|
else
|
||||||
|
Tcentralina = [BatTempo;BatData];
|
||||||
|
end
|
||||||
|
% Modifico il formato di data e ora in DATini.
|
||||||
|
DAT = [BatTempo(:,1:2); BatData(:,1:2)];
|
||||||
|
[rD,~] = size(DAT);
|
||||||
|
T = [cell2mat(DAT(:,1)) repmat(' ', [rD,1]) cell2mat(DAT(:,2))];
|
||||||
|
T = datenum(T);
|
||||||
|
% Converto da Cell Array a Matrice.
|
||||||
|
DATA = T;
|
||||||
|
|
||||||
|
end
|
||||||
125
ATD/checkBattery.m
Executable file
125
ATD/checkBattery.m
Executable file
@@ -0,0 +1,125 @@
|
|||||||
|
function checkBattery(Batteria,IDcentralina,Mail,conn,FileName)
|
||||||
|
|
||||||
|
text = 'checkBattery function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
comando = ['select type_id from units where name = ''' IDcentralina ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Type = cell2mat(curs.Data);
|
||||||
|
if Type == 1 || Type == 2 || Type == 3 || Type == 4 % G801, G802, G201, G301
|
||||||
|
Batt = 12;
|
||||||
|
Threshold = 11;
|
||||||
|
Dato = cellstr('12 V');
|
||||||
|
elseif Type == 5 % D2W
|
||||||
|
Batt = 6;
|
||||||
|
Threshold = 5.6;
|
||||||
|
Dato = cellstr('6 V');
|
||||||
|
elseif Type == 7 % NESA
|
||||||
|
Batt = 3.4;
|
||||||
|
Threshold = 3;
|
||||||
|
Dato = cellstr('3.4 V');
|
||||||
|
end
|
||||||
|
|
||||||
|
FileNameBattery = strcat(IDcentralina,'-Batteria.txt');
|
||||||
|
if isfile(FileNameBattery) == 0 % NON Esiste
|
||||||
|
outdat = fopen(FileNameBattery,'wt+');
|
||||||
|
fileID_site = fopen(FileNameBattery,'a');
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,Batt);
|
||||||
|
fmt = '%.10f \r';
|
||||||
|
text = now;
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
end
|
||||||
|
|
||||||
|
% Scarico dati di riferimento
|
||||||
|
FileNameBattery = ['' IDcentralina '-Batteria.txt'];
|
||||||
|
Dati = importdata(FileNameBattery);
|
||||||
|
[rA,~] = size(Dati);
|
||||||
|
if rA == 0
|
||||||
|
Livello_Rif = 0;
|
||||||
|
Data_Rif = 0;
|
||||||
|
elseif rA == 1
|
||||||
|
Livello_Rif = Dati(1,1);
|
||||||
|
Data_Rif = 0;
|
||||||
|
else
|
||||||
|
Livello_Rif = Dati(1,1);
|
||||||
|
Data_Rif = Dati(2,1);
|
||||||
|
end
|
||||||
|
|
||||||
|
Level = cell2mat(Batteria(end,3));
|
||||||
|
activate = 0;
|
||||||
|
|
||||||
|
if Level < Threshold
|
||||||
|
if now-Data_Rif > 1 || Level < Livello_Rif
|
||||||
|
Data_Rif = now;
|
||||||
|
activate = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if activate == 0
|
||||||
|
Mail = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
if Mail == 1
|
||||||
|
|
||||||
|
DATAinsert = cell(1,6);
|
||||||
|
sms = 0;
|
||||||
|
desc = Dato;
|
||||||
|
Data = datestr(strjoin([Batteria(end,1) Batteria(end,2)]),'yyyy-mm-dd HH:MM:SS');
|
||||||
|
Livello = cell2mat(Batteria(end,3));
|
||||||
|
DATAinsert{1,1} = 2; % Allarme tipologia batteria
|
||||||
|
DATAinsert{1,2} = IDcentralina;
|
||||||
|
DATAinsert{1,3} = Data;
|
||||||
|
DATAinsert{1,4} = Livello;
|
||||||
|
DATAinsert{1,5} = sms;
|
||||||
|
DATAinsert{1,6} = desc;
|
||||||
|
|
||||||
|
% Cerco se il dato è già presente
|
||||||
|
comando = ['select id, type_id, date_time from alarms where unit_name = ''' ...
|
||||||
|
IDcentralina ''' and date_time = ''' Data ''' and type_id = ''' DATAinsert{1,1} ...
|
||||||
|
''' and registered_value = ''' Livello ''' and description like ''' desc ''' order by date_time'];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
idDate = curs.Data;
|
||||||
|
[~,cI] = size(idDate);
|
||||||
|
if cI == 1
|
||||||
|
idElabData = 0; % 0 indica che il dato non è presente su DB
|
||||||
|
else
|
||||||
|
idElabData = cell2mat(idDate(:,1));
|
||||||
|
end
|
||||||
|
tablename = 'alarms';
|
||||||
|
colnames = {'type_id','unit_name','date_time','battery_level','send_sms','description'};
|
||||||
|
data = [DATAinsert(1,1),DATAinsert(1,2),DATAinsert(1,3),DATAinsert(1,4),...
|
||||||
|
DATAinsert(1,5),DATAinsert(1,6)];
|
||||||
|
if idElabData == 0 % Scrivo
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
text = ['ALERT was written in the DB by checkBattery function for date: ''' Data ''' '];
|
||||||
|
end
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
|
|
||||||
|
outdat = fopen(FileNameBattery,'wt+');
|
||||||
|
fileID_site = fopen(FileNameBattery,'a');
|
||||||
|
text_B = cell2mat(Batteria(end,3));
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,text_B);
|
||||||
|
fmt = '%.10f \r';
|
||||||
|
text = Data_Rif;
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
|
||||||
|
text = 'checkBattery function worked correctly';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
117
ATD/checkGIS.m
Executable file
117
ATD/checkGIS.m
Executable file
@@ -0,0 +1,117 @@
|
|||||||
|
function checkGIS(siteID,NomeSito,conn,FileName)
|
||||||
|
|
||||||
|
text = 'checkGIS function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
comando = ['select gis_enable, gis_duedate from sites where id like ''' siteID ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
GIS = curs.Data;
|
||||||
|
if cell2mat(GIS(1)) == 1 % GIS attivato
|
||||||
|
if strcmp(char(GIS(2)),'null') == 0
|
||||||
|
FileNameGIS = ['GIS' siteID '-Deadline.txt'];
|
||||||
|
if isfile(FileNameGIS) == 0 % NON Esiste
|
||||||
|
outdat = fopen(FileNameGIS,'wt+');
|
||||||
|
fileID_site = fopen(FileNameGIS,'a');
|
||||||
|
text = now;
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
end
|
||||||
|
|
||||||
|
% Scarico dati di riferimento
|
||||||
|
Data_Rif = importdata(FileNameGIS);
|
||||||
|
[rA,~] = size(Data_Rif);
|
||||||
|
if rA == 0
|
||||||
|
Data_Rif = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Controllo la data di scadenza del GIS
|
||||||
|
G = cell2mat(GIS(2));
|
||||||
|
[lS] = length(G);
|
||||||
|
date = G(1:10);
|
||||||
|
time = G(12:lS);
|
||||||
|
Date = [date ' ' time];
|
||||||
|
|
||||||
|
Info = 0;
|
||||||
|
if now <= datenum(Date) && datenum(Date) < now+30 % fra 1 giorno e 1 Mese
|
||||||
|
if datenum(Data_Rif) > datenum(Date)-30
|
||||||
|
mail = 0; % la mail è già stata inviata
|
||||||
|
else
|
||||||
|
mail = 1;
|
||||||
|
end
|
||||||
|
elseif now > datenum(Date) && datenum(Data_Rif) < datenum(Date) % GIS scaduto
|
||||||
|
mail = 1;
|
||||||
|
Info = 1;
|
||||||
|
desc = 'Scaduto';
|
||||||
|
else
|
||||||
|
mail = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
if mail == 1
|
||||||
|
DATAinsert = cell(1,5);
|
||||||
|
sms = 0;
|
||||||
|
Data = datestr(now,'yyyy-mm-dd HH:MM:SS');
|
||||||
|
DATAinsert{1,1} = 8; % Allarme scadenza GIS
|
||||||
|
DATAinsert{1,2} = cellstr(['GIS|' char(NomeSito)]);
|
||||||
|
DATAinsert{1,3} = Data;
|
||||||
|
DATAinsert{1,4} = sms;
|
||||||
|
if Info == 1
|
||||||
|
DATAinsert{1,5} = desc;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Cerco se il dato è già presente
|
||||||
|
if Info == 1
|
||||||
|
comando = ['select id, type_id, date_time from alarms where tool_name = ''' ...
|
||||||
|
NomeSito ''' and date_time = ''' Data ''' and type_id = ''' DATAinsert{1,1} ...
|
||||||
|
''' and description like ''' desc ''' order by date_time'];
|
||||||
|
else
|
||||||
|
comando = ['select id, type_id, date_time from alarms where tool_name = ''' ...
|
||||||
|
NomeSito ''' and date_time = ''' Data ''' and type_id = ''' DATAinsert{1,1} ...
|
||||||
|
''' order by date_time'];
|
||||||
|
end
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
idDate = curs.Data;
|
||||||
|
[~,cI] = size(idDate);
|
||||||
|
if cI == 1
|
||||||
|
idElabData = 0; % 0 indica che il dato non è presente su DB
|
||||||
|
else
|
||||||
|
idElabData = cell2mat(idDate(:,1));
|
||||||
|
end
|
||||||
|
tablename = 'alarms';
|
||||||
|
if Info == 1
|
||||||
|
colnames = {'type_id','tool_name','date_time','send_sms','description'};
|
||||||
|
data = [DATAinsert(1,1),DATAinsert(1,2),DATAinsert(1,3),DATAinsert(1,4),DATAinsert(1,5)];
|
||||||
|
else
|
||||||
|
colnames = {'type_id','tool_name','date_time','send_sms'};
|
||||||
|
data = [DATAinsert(1,1),DATAinsert(1,2),DATAinsert(1,3),DATAinsert(1,4)];
|
||||||
|
end
|
||||||
|
if idElabData == 0 % Scrivo
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
text = ['ALERT was written in the DB by checkGIS function for date: ''' Data ''' '];
|
||||||
|
end
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
|
outdat = fopen(FileNameGIS,'wt+');
|
||||||
|
fileID_site = fopen(FileNameGIS,'a');
|
||||||
|
text = now;
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'checkGIS function worked correctly';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
124
ATD/checkSIM.m
Executable file
124
ATD/checkSIM.m
Executable file
@@ -0,0 +1,124 @@
|
|||||||
|
function checkSIM(IDcentralina,conn,FileName)
|
||||||
|
|
||||||
|
text = 'checkSIM function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
comando = ['select sim_card_id from units where name = ''' IDcentralina ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
sim_ID = cell2mat(curs.Data);
|
||||||
|
|
||||||
|
if isnan(sim_ID) == 0
|
||||||
|
if sim_ID ~= 0
|
||||||
|
comando = ['select name, duedate from sim_cards where id = ''' num2str(sim_ID) ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
SIM = curs.Data;
|
||||||
|
Nome = char(SIM(1));
|
||||||
|
|
||||||
|
FileNameSIM = ['' Nome '-Deadline.txt'];
|
||||||
|
if isfile(FileNameSIM) == 0 % NON Esiste
|
||||||
|
outdat = fopen(FileNameSIM,'wt+');
|
||||||
|
fileID_site = fopen(FileNameSIM,'a');
|
||||||
|
text = now;
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
end
|
||||||
|
|
||||||
|
% Scarico dati di riferimento
|
||||||
|
FileNameSIM = ['' IDcentralina '-Deadline.txt'];
|
||||||
|
Data_Rif = importdata(FileNameSIM);
|
||||||
|
[rA,~] = size(Data_Rif);
|
||||||
|
if rA == 0
|
||||||
|
Data_Rif = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Controllo la data di scadenza della SIM
|
||||||
|
Date = SIM(2);
|
||||||
|
Check = cell2mat(Date);
|
||||||
|
Info = 0;
|
||||||
|
if strcmp(Check,'null') == 1|| strcmp(Check,'No Data') == 1
|
||||||
|
else
|
||||||
|
if now <= datenum(Date) && datenum(Date) < now+30 % fra 1 giorno e 1 Mese
|
||||||
|
if datenum(Data_Rif) > datenum(Date)-30
|
||||||
|
mail = 0; % la mail è già stata inviata
|
||||||
|
else
|
||||||
|
mail = 1;
|
||||||
|
end
|
||||||
|
elseif now > datenum(Date) && datenum(Data_Rif) < datenum(Date) % sim scaduta
|
||||||
|
mail = 1;
|
||||||
|
Info = 1;
|
||||||
|
desc = 'Scaduto';
|
||||||
|
else
|
||||||
|
mail = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
if mail == 1
|
||||||
|
DATAinsert = cell(1,6);
|
||||||
|
sms = 0;
|
||||||
|
Data = datestr(now,'yyyy-mm-dd HH:MM:SS');
|
||||||
|
DATAinsert{1,1} = 7; % Allarme scadenza SIM
|
||||||
|
DATAinsert{1,2} = Nome;
|
||||||
|
DATAinsert{1,3} = Data;
|
||||||
|
DATAinsert{1,4} = sms;
|
||||||
|
if Info == 1
|
||||||
|
DATAinsert{1,5} = desc;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Cerco se il dato è già presente
|
||||||
|
if Info == 1
|
||||||
|
comando = ['select id, type_id, date_time from alarms where tool_name = ''' ...
|
||||||
|
Nome ''' and date_time = ''' Data ''' and type_id = ''' DATAinsert{1,1} ...
|
||||||
|
''' and description like ''' desc ''' order by date_time'];
|
||||||
|
else
|
||||||
|
comando = ['select id, type_id, date_time from alarms where tool_name = ''' ...
|
||||||
|
Nome ''' and date_time = ''' Data ''' and type_id = ''' DATAinsert{1,1} ...
|
||||||
|
''' order by date_time'];
|
||||||
|
end
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
idDate = curs.Data;
|
||||||
|
[~,cI] = size(idDate);
|
||||||
|
if cI == 1
|
||||||
|
idElabData = 0; % 0 indica che il dato non è presente su DB
|
||||||
|
else
|
||||||
|
idElabData = cell2mat(idDate(:,1));
|
||||||
|
end
|
||||||
|
tablename = 'alarms';
|
||||||
|
if Info == 1
|
||||||
|
colnames = {'type_id','tool_name','date_time','send_sms','description'};
|
||||||
|
data = [DATAinsert(1,1),DATAinsert(1,2),DATAinsert(1,3),DATAinsert(1,4),DATAinsert(1,5)];
|
||||||
|
else
|
||||||
|
colnames = {'type_id','tool_name','date_time','send_sms'};
|
||||||
|
data = [DATAinsert(1,1),DATAinsert(1,2),DATAinsert(1,3),DATAinsert(1,4)];
|
||||||
|
end
|
||||||
|
if idElabData == 0 % Scrivo
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
text = ['ALERT was written in the DB by checkSIM function for date: ''' Data ''' '];
|
||||||
|
end
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
|
outdat = fopen(FileNameSIM,'wt+');
|
||||||
|
fileID_site = fopen(FileNameSIM,'a');
|
||||||
|
text = now;
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'checkSIM function worked correctly';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
113
ATD/checkUnit.m
Executable file
113
ATD/checkUnit.m
Executable file
@@ -0,0 +1,113 @@
|
|||||||
|
function checkUnit(IDcentralina,conn,FileName)
|
||||||
|
|
||||||
|
text = 'checkUnit function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
FileNameUnit = ['' IDcentralina '-Deadline.txt'];
|
||||||
|
if isfile(FileNameUnit) == 0 % NON Esiste
|
||||||
|
outdat = fopen(FileNameUnit,'wt+');
|
||||||
|
fileID_site = fopen(FileNameUnit,'a');
|
||||||
|
text = now;
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
end
|
||||||
|
|
||||||
|
% Scarico dati di riferimento
|
||||||
|
FileNameUnit = ['' IDcentralina '-Deadline.txt'];
|
||||||
|
Data_Rif = importdata(FileNameUnit);
|
||||||
|
[rA,~] = size(Data_Rif);
|
||||||
|
if rA == 0
|
||||||
|
Data_Rif = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Cerco la data di scadenza della centralina
|
||||||
|
comando = ['select duedate from units where name = ''' IDcentralina ''' '];
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
Date = curs.Data;
|
||||||
|
Check = cell2mat(Date);
|
||||||
|
Info = 0;
|
||||||
|
if strcmp(Check,'null') == 1|| strcmp(Check,'No Data') == 1
|
||||||
|
else
|
||||||
|
if now <= datenum(Date) && datenum(Date) < now+30 % fra 1 giorno e 1 Mese
|
||||||
|
if datenum(Data_Rif) > datenum(Date)-30
|
||||||
|
mail = 0; % la mail è già stata inviata
|
||||||
|
else
|
||||||
|
mail = 1;
|
||||||
|
end
|
||||||
|
elseif now > datenum(Date) && datenum(Data_Rif) < datenum(Date) % centralina scaduta
|
||||||
|
mail = 1;
|
||||||
|
Info = 1;
|
||||||
|
desc = 'Scaduto';
|
||||||
|
else
|
||||||
|
mail = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
if mail == 1
|
||||||
|
DATAinsert = cell(1,6);
|
||||||
|
sms = 0;
|
||||||
|
Data = datestr(now,'yyyy-mm-dd HH:MM:SS');
|
||||||
|
DATAinsert{1,1} = 5; % Allarme scadenza centralina
|
||||||
|
DATAinsert{1,2} = IDcentralina;
|
||||||
|
DATAinsert{1,3} = Data;
|
||||||
|
DATAinsert{1,4} = sms;
|
||||||
|
if Info == 1
|
||||||
|
DATAinsert{1,5} = desc;
|
||||||
|
end
|
||||||
|
|
||||||
|
% Cerco se il dato è già presente
|
||||||
|
if Info == 1
|
||||||
|
comando = ['select id, type_id, date_time from alarms where unit_name = ''' ...
|
||||||
|
IDcentralina ''' and date_time = ''' Data ''' and type_id = ''' DATAinsert{1,1} ...
|
||||||
|
''' and description like ''' desc ''' order by date_time'];
|
||||||
|
else
|
||||||
|
comando = ['select id, type_id, date_time from alarms where unit_name = ''' ...
|
||||||
|
IDcentralina ''' and date_time = ''' Data ''' and type_id = ''' DATAinsert{1,1} ...
|
||||||
|
''' order by date_time'];
|
||||||
|
end
|
||||||
|
curs = exec(conn,comando);
|
||||||
|
curs = fetch(curs);
|
||||||
|
idDate = curs.Data;
|
||||||
|
[~,cI] = size(idDate);
|
||||||
|
if cI == 1
|
||||||
|
idElabData = 0; % 0 indica che il dato non è presente su DB
|
||||||
|
else
|
||||||
|
idElabData = cell2mat(idDate(:,1));
|
||||||
|
end
|
||||||
|
tablename = 'alarms';
|
||||||
|
if Info == 1
|
||||||
|
colnames = {'type_id','unit_name','date_time','send_sms','description'};
|
||||||
|
data = [DATAinsert(1,1),DATAinsert(1,2),DATAinsert(1,3),DATAinsert(1,4),DATAinsert(1,5)];
|
||||||
|
else
|
||||||
|
colnames = {'type_id','unit_name','date_time','send_sms'};
|
||||||
|
data = [DATAinsert(1,1),DATAinsert(1,2),DATAinsert(1,3),DATAinsert(1,4)];
|
||||||
|
end
|
||||||
|
if idElabData == 0 % Scrivo
|
||||||
|
fastinsert(conn,tablename,colnames,data);
|
||||||
|
text = ['ALERT was written in the DB by checkUnit function for date: ''' Data ''' '];
|
||||||
|
end
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
|
|
||||||
|
outdat = fopen(FileNameUnit,'wt+');
|
||||||
|
fileID_site = fopen(FileNameUnit,'a');
|
||||||
|
text = now;
|
||||||
|
fmt = '%f \r';
|
||||||
|
fprintf(fileID_site,fmt,text);
|
||||||
|
fclose(fileID_site);
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'checkUnit function worked correctly';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
67
ATD/check_RL.m
Executable file
67
ATD/check_RL.m
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
function [ax,ay,az] = check_RL(ax,ay,az,rRL,IDcentralina,DTcatena,FileName)
|
||||||
|
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
|
||||||
|
incliX = ax;
|
||||||
|
incliY = ay;
|
||||||
|
incliZ = az;
|
||||||
|
|
||||||
|
switchXY = zeros(rRL,1);
|
||||||
|
switchYZ = zeros(rRL,1);
|
||||||
|
switch_signXY = zeros(rRL,1);
|
||||||
|
|
||||||
|
instAx = ax(:,1);
|
||||||
|
instAy = ay(:,1);
|
||||||
|
|
||||||
|
for i = 1:rRL
|
||||||
|
if instAy(i,1) < 0 && abs(instAx(i,1)) < sin(pi/6) % il nodo è sottosopra, devo cambiare i segni di X e Y
|
||||||
|
switch_signXY(i,1) = 1;
|
||||||
|
end
|
||||||
|
if instAx(i,1) > sin(pi/6) || instAx(i,1) < sin(-pi/6) % uso Z anzichè Y
|
||||||
|
if instAx(i,1) > sin(pi/4)
|
||||||
|
switchXY(i,1) = 1;
|
||||||
|
elseif instAx(i,1) < sin(-pi/4) % uso X anzichè Y
|
||||||
|
switchXY(i,1) = -1;
|
||||||
|
else
|
||||||
|
switchYZ(i,1) = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if switch_signXY(i,1) == 1
|
||||||
|
ax(i,:) = -incliX(i,:);
|
||||||
|
ay(i,:) = -incliY(i,:);
|
||||||
|
text = ['ax and ay signs changed during the execution of check_RL function of Radial Link node number ' num2str(i)];
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
if switchXY(i,1) == 1
|
||||||
|
ax(i,:) = incliY(i,:);
|
||||||
|
ay(i,:) = incliX(i,:);
|
||||||
|
text = ['ax and ay switched during the execution of check_RL function of Radial Link node number ' num2str(i)];
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
elseif switchXY(i,1) == -1
|
||||||
|
ax(i,:) = -incliY(i,:);
|
||||||
|
ay(i,:) = -incliX(i,:);
|
||||||
|
text = ['ax and ay switched and signs changed during the execution of check_RL function of Radial Link node number ' num2str(i)];
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
if switchYZ(i,1) == 1
|
||||||
|
az(i,:) = -incliY(i,:);
|
||||||
|
ay(i,:) = -incliZ(i,:);
|
||||||
|
text = ['ay and az switched and signs changed during the execution of check_RL function of Radial Link node number ' num2str(i)];
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
nameXY = strcat([IDcentralina,'-',DTcatena,'-','switchXY']);
|
||||||
|
name_switchXY = strcat([IDcentralina,'-',DTcatena,'-','switch_signXY']);
|
||||||
|
nameYZ = strcat([IDcentralina,'-',DTcatena,'-','switchYZ']);
|
||||||
|
save(nameXY,'switchXY')
|
||||||
|
save(nameYZ,'switchYZ')
|
||||||
|
save(name_switchXY,'switch_signXY')
|
||||||
|
|
||||||
|
|
||||||
|
text = 'check_RL function executed correctly';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
end
|
||||||
|
|
||||||
124
ATD/checkdata.m
Executable file
124
ATD/checkdata.m
Executable file
@@ -0,0 +1,124 @@
|
|||||||
|
function [DatiElabTunnelLink,DatiElabRadialLink,DatiElabTiltLinkH,DatiElabTiltLinkHRH,...
|
||||||
|
DatiElabPreConvLink,DatiElabPreConvLinkHR,DatiElabAnalogLink,DatiElabDistoMTLink]...
|
||||||
|
= checkdata(yesTuL,yesRL,yesTLH,yesTLHRH,yesPCL,yesPCLHR,yesAL,yesDM,...
|
||||||
|
DatiElabTunnelLink,DatiElabRadialLink,DatiElabTiltLinkH,DatiElabTiltLinkHRH,...
|
||||||
|
DatiElabPreConvLink,DatiElabPreConvLinkHR,DatiElabAnalogLink,DatiElabDistoMTLink,...
|
||||||
|
datainiTuL,tempoiniTuL,datainiRL,tempoiniRL,datainiTLH,tempoiniTLH,...
|
||||||
|
datainiTLHRH,tempoiniTLHRH,datainiPCL,tempoiniPCL,datainiPCLHR,tempoiniPCLHR,...
|
||||||
|
datainiAL,tempoiniAL,datainiDM,tempoiniDM,rTuL,rRL,rTLH,rTLHRH,rPCL,rPCLHR,rAL,rDM,...
|
||||||
|
NodoTunnelLink,NodoRadialLink,NodoTiltLinkH,NodoTiltLinkHRH,NodoPreConvLink,...
|
||||||
|
NodoPreConvLinkHR,NodoAnalogLink,NodoDistoMTLink,NuovoZeroTuL,NuovoZeroRL,NuovoZeroTLH,...
|
||||||
|
NuovoZeroTLHRH,NuovoZeroPCL,NuovoZeroPCLHR,NuovoZeroAL,NuovoZeroDM,...
|
||||||
|
IDcentralina,DTcatena,conn,FileName)
|
||||||
|
|
||||||
|
text = 'checkdata function started';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
%% Tunnel Link
|
||||||
|
if yesTuL == 1
|
||||||
|
if NuovoZeroTuL == 1
|
||||||
|
data1 = datenum([char(DatiElabTunnelLink(1,1)) ' ' char(DatiElabTunnelLink(1,2))]); % Prima data elaborata
|
||||||
|
data2 = datenum([datainiTuL(1,1:10),' ',tempoiniTuL]); % Prima data grezza
|
||||||
|
if data2 ~= data1 % devo riscaricare l'ultimo dato elaborato a partire da dataini
|
||||||
|
datainiTuL = datestr(data2,'yyyy-mm-dd');
|
||||||
|
tempoiniTuL = datestr(data2,'HH:MM:SS');
|
||||||
|
DatiElabTunnelLink = LastElab_bisTuL(conn,NodoTunnelLink,rTuL,...
|
||||||
|
datainiTuL,tempoiniTuL,IDcentralina,DTcatena,FileName);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Radial Link
|
||||||
|
if yesRL == 1
|
||||||
|
if NuovoZeroRL == 1
|
||||||
|
data1 = datenum([char(DatiElabRadialLink(1,1)) ' ' char(DatiElabRadialLink(1,2))]); % Prima data elaborata
|
||||||
|
data2 = datenum([datainiRL(1,1:10),' ',tempoiniRL]); % Prima data grezza
|
||||||
|
if data2 ~= data1 % devo riscaricare l'ultimo dato elaborato a partire da dataini
|
||||||
|
datainiRL = datestr(data2,'yyyy-mm-dd');
|
||||||
|
tempoiniRL = datestr(data2,'HH:MM:SS');
|
||||||
|
DatiElabRadialLink = LastElab_bisRL(conn,NodoRadialLink,rRL,...
|
||||||
|
datainiRL,tempoiniRL,IDcentralina,DTcatena,FileName);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Tilt Link H
|
||||||
|
if yesTLH == 1
|
||||||
|
if NuovoZeroTLH == 1
|
||||||
|
data1 = datenum([char(DatiElabTiltLinkH(1,1)) ' ' char(DatiElabTiltLinkH(1,2))]); % Prima data elaborata
|
||||||
|
data2 = datenum([datainiTLH(1,1:10),' ',tempoiniTLH]); % Prima data grezza
|
||||||
|
if data2 ~= data1 % devo riscaricare l'ultimo dato elaborato a partire da dataini
|
||||||
|
datainiTLH = datestr(data2,'yyyy-mm-dd');
|
||||||
|
tempoiniTLH = datestr(data2,'HH:MM:SS');
|
||||||
|
DatiElabTiltLinkH = LastElab_bisTLH(conn,NodoTiltLinkH,rTLH,...
|
||||||
|
datainiTLH,tempoiniTLH,IDcentralina,DTcatena,FileName);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Tilt Link HR H
|
||||||
|
if yesTLHRH == 1
|
||||||
|
if NuovoZeroTLHRH == 1
|
||||||
|
data1 = datenum([char(DatiElabTiltLinkHRH(1,1)) ' ' char(DatiElabTiltLinkHRH(1,2))]); % Prima data elaborata
|
||||||
|
data2 = datenum([datainiTLHRH(1,1:10),' ',tempoiniTLHRH]); % Prima data grezza
|
||||||
|
if data2 ~= data1 % devo riscaricare l'ultimo dato elaborato a partire da dataini
|
||||||
|
datainiTLHRH = datestr(data2,'yyyy-mm-dd');
|
||||||
|
tempoiniTLHRH = datestr(data2,'HH:MM:SS');
|
||||||
|
DatiElabTiltLinkHRH = LastElab_bisTLHRH(conn,NodoTiltLinkHRH,rTLHRH,...
|
||||||
|
datainiTLHRH,tempoiniTLHRH,IDcentralina,DTcatena,FileName);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%% PreConv Link
|
||||||
|
if yesPCL == 1
|
||||||
|
if NuovoZeroPCL == 1
|
||||||
|
data1 = datenum([char(DatiElabPreConvLink(1,1)) ' ' char(DatiElabPreConvLink(1,2))]); % Prima data elaborata
|
||||||
|
data2 = datenum([datainiPCL(1,1:10),' ',tempoiniPCL]); % Prima data grezza
|
||||||
|
if data2 ~= data1 % devo riscaricare l'ultimo dato elaborato a partire da dataini
|
||||||
|
datainiPCL = datestr(data2,'yyyy-mm-dd');
|
||||||
|
tempoiniPCL = datestr(data2,'HH:MM:SS');
|
||||||
|
DatiElabPreConvLink = LastElab_bisPCL(conn,NodoPreConvLink,rPCL,...
|
||||||
|
datainiPCL,tempoiniPCL,IDcentralina,DTcatena,FileName);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%% PreConv Link HR
|
||||||
|
if yesPCLHR == 1
|
||||||
|
if NuovoZeroPCLHR == 1
|
||||||
|
data1 = datenum([char(DatiElabPreConvLinkHR(1,1)) ' ' char(DatiElabPreConvLinkHR(1,2))]); % Prima data elaborata
|
||||||
|
data2 = datenum([datainiPCLHR(1,1:10),' ',tempoiniPCLHR]); % Prima data grezza
|
||||||
|
if data2 ~= data1 % devo riscaricare l'ultimo dato elaborato a partire da dataini
|
||||||
|
datainiPCLHR = datestr(data2,'yyyy-mm-dd');
|
||||||
|
tempoiniPCLHR = datestr(data2,'HH:MM:SS');
|
||||||
|
DatiElabPreConvLinkHR = LastElab_bisPCLHR(conn,NodoPreConvLinkHR,rPCLHR,...
|
||||||
|
datainiPCLHR,tempoiniPCLHR,IDcentralina,DTcatena,FileName);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Analog Link
|
||||||
|
if yesAL == 1
|
||||||
|
if NuovoZeroAL == 1
|
||||||
|
data1 = datenum([char(DatiElabAnalogLink(1,1)) ' ' char(DatiElabAnalogLink(1,2))]); % Prima data elaborata
|
||||||
|
data2 = datenum([datainiAL(1,1:10),' ',tempoiniAL]); % Prima data grezza
|
||||||
|
if data2 ~= data1 % devo riscaricare l'ultimo dato elaborato a partire da dataini
|
||||||
|
datainiAL = datestr(data2,'yyyy-mm-dd');
|
||||||
|
tempoiniAL = datestr(data2,'HH:MM:SS');
|
||||||
|
DatiElabAnalogLink = LastElab_bisAL(conn,NodoAnalogLink,rAL,...
|
||||||
|
datainiAL,tempoiniAL,IDcentralina,DTcatena,FileName);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text = 'checkdata function worked correctly';
|
||||||
|
fileID = fopen(FileName,'a');
|
||||||
|
fmt = '%s \r';
|
||||||
|
fprintf(fileID,fmt,text);
|
||||||
|
fclose(fileID);
|
||||||
|
|
||||||
|
end
|
||||||
263
ATD/columnlegend.m
Executable file
263
ATD/columnlegend.m
Executable file
@@ -0,0 +1,263 @@
|
|||||||
|
function [legend_h,object_h,plot_h,text_strings] = columnlegend(numcolumns, str, varargin)
|
||||||
|
%
|
||||||
|
% columnlegend creates a legend with a specified number of columns.
|
||||||
|
%
|
||||||
|
% columnlegend(numcolumns, str, varargin)
|
||||||
|
% numcolumns - number of columns in the legend
|
||||||
|
% str - cell array of strings for the legend
|
||||||
|
%
|
||||||
|
% Additional Input Options:
|
||||||
|
% columnlegend(..., 'location', loc)
|
||||||
|
% loc - location variable for legend, default is 'NorthEast'
|
||||||
|
% possible values: 'NorthWest', 'NorthEast', 'SouthEast', 'SouthWest',
|
||||||
|
% 'NorthOutside', 'SouthOutside',
|
||||||
|
% 'NortheastOutside', 'SoutheastOutside'
|
||||||
|
%
|
||||||
|
% columnlegend(numcolumns, str, 'padding', 0.5); % add 50% vertical padding between legend entries (relative to original height)
|
||||||
|
%
|
||||||
|
% columnlegend(..., 'boxon')
|
||||||
|
% columnlegend(..., 'boxoff')
|
||||||
|
% set legend bounding box on/off
|
||||||
|
%
|
||||||
|
% example:
|
||||||
|
% plot(bsxfun(@times, [0:9]',[1:10]));
|
||||||
|
% columnlegend(3, cellstr(num2str([1:10]')), 'location','northwest');
|
||||||
|
%
|
||||||
|
%
|
||||||
|
% Author: Simon Henin <shenin@gc.cuny.edu>
|
||||||
|
%
|
||||||
|
% 4/09/2013 - Fixed bug with 3 entries / 3 columns
|
||||||
|
% 4/09/2013 - Added bounding box option as per @Durga Lal Shrestha (fileexchage)
|
||||||
|
% 11 May 2010 - 1.2 Add instructions for printing figure with columns
|
||||||
|
% 08 Feb 2011 - 1.4 Added functionality when using markers.
|
||||||
|
% 31 Oct 2015 - Updates for compatibility with 2015a, Adds minor improvements as per user suggestions
|
||||||
|
% 07 Nov 2016 - Bug fixes, added functionality for bar plots, added all valid legend locations
|
||||||
|
% 07 Jun 2017 - Added a quick padding feature that creates additional
|
||||||
|
% vertical space between legend entries.
|
||||||
|
location = 'NorthEast';
|
||||||
|
boxon = false; legend_h = false; padding = 0; extravars = [];
|
||||||
|
for i=1:2:length(varargin)
|
||||||
|
switch lower(varargin{i})
|
||||||
|
case 'location'
|
||||||
|
location = varargin{i+1};
|
||||||
|
i=i+2;
|
||||||
|
case 'boxon'
|
||||||
|
boxon = true;
|
||||||
|
case 'boxoff'
|
||||||
|
boxon = false;
|
||||||
|
case 'legend'
|
||||||
|
legend_h = varargin{i+1};
|
||||||
|
i=i+2;
|
||||||
|
case 'object'
|
||||||
|
object_h = varargin{i+1};
|
||||||
|
i=i+2;
|
||||||
|
case 'padding'
|
||||||
|
padding = varargin{i+1};
|
||||||
|
i=i+2;
|
||||||
|
otherwise
|
||||||
|
extravars{end+1} = varargin{i};
|
||||||
|
extravars{end+1} = varargin{i+1};
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if legend_h == false
|
||||||
|
%create the legend
|
||||||
|
if ~isempty(extravars)
|
||||||
|
[legend_h,object_h,plot_h,text_strings] = legend(str, extravars{:});
|
||||||
|
else
|
||||||
|
[legend_h,object_h,plot_h,text_strings] = legend(str);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%some variables
|
||||||
|
numlines = length(str);
|
||||||
|
numpercolumn = ceil(numlines/numcolumns);
|
||||||
|
%get old width, new width and scale factor
|
||||||
|
set(legend_h, 'units', 'normalized');
|
||||||
|
set(gca, 'units', 'normalized');
|
||||||
|
pos = get(legend_h, 'position');
|
||||||
|
width = numcolumns*pos(3);
|
||||||
|
newheight = (pos(4)/numlines)*numpercolumn;
|
||||||
|
rescale = pos(3)/width;
|
||||||
|
%get some old values so we can scale everything later
|
||||||
|
type = get(object_h(numlines+1), 'type');
|
||||||
|
switch type
|
||||||
|
case {'line'}
|
||||||
|
xdata = get(object_h(numlines+1), 'xdata');
|
||||||
|
ydata1 = get(object_h(numlines+1), 'ydata');
|
||||||
|
ydata2 = get(object_h(numlines+3), 'ydata');
|
||||||
|
|
||||||
|
%we'll use these later to align things appropriately
|
||||||
|
sheight = ydata1(1)-ydata2(1) + (ydata1(1)-ydata2(1))*padding; % height between data lines
|
||||||
|
height = ydata1(1) + (ydata1(1)-ydata2(1))*padding*2; % height of the box. Used to top margin offset
|
||||||
|
line_width = (xdata(2)-xdata(1))*rescale; % rescaled linewidth to match original
|
||||||
|
spacer = xdata(1)*rescale; % rescaled spacer used for margins
|
||||||
|
case {'hggroup'}
|
||||||
|
text_pos = get(object_h(1), 'position');
|
||||||
|
child = get(object_h(numlines+1), 'children');
|
||||||
|
% determine if bar or errorbar
|
||||||
|
subtype = get(child, 'Type');
|
||||||
|
if strcmpi(subtype, 'patch') % bar
|
||||||
|
vertices_1 = get(child, 'vertices');
|
||||||
|
child = get(object_h(numlines+2), 'children');
|
||||||
|
vertices_2 = get(child, 'vertices');
|
||||||
|
sheight = vertices_1(2,2)-vertices_1(1,2);
|
||||||
|
height = vertices_1(2,2);
|
||||||
|
line_width = (vertices_1(3,1)-vertices_1(1,1))*rescale; % rescaled linewidth to match original
|
||||||
|
spacer = vertices_1(1,2)-vertices_2(2,2); % rescaled spacer used for margins
|
||||||
|
text_space = (text_pos(1)-vertices_1(4,1))./numcolumns;
|
||||||
|
elseif strcmpi(subtype, 'hggroup') % errorbar
|
||||||
|
child1 = get(get(object_h(numlines+1), 'children'), 'children');
|
||||||
|
child1 = child1(2);
|
||||||
|
child2 = get(get(object_h(numlines+2), 'children'), 'children');
|
||||||
|
child2 = child2(2);
|
||||||
|
xdata = get(child1, 'xdata');
|
||||||
|
ydata1 = get(child1, 'ydata');
|
||||||
|
ydata2 = get(child2, 'ydata');
|
||||||
|
%we'll use these later to align things appropriately
|
||||||
|
sheight = ydata1(1)-ydata2(1) + (ydata1(1)-ydata2(1))*padding; % height between data lines
|
||||||
|
height = ydata1(1) + (ydata1(1)-ydata2(1))*padding*2; % height of the box. Used to top margin offset
|
||||||
|
line_width = (xdata(2)-xdata(1))*rescale; % rescaled linewidth to match original
|
||||||
|
spacer = xdata(1)*rescale; % rescaled spacer used for margins
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%put the legend on the upper left corner to make initial adjustments easier
|
||||||
|
% set(gca, 'units', 'pixels');
|
||||||
|
loci = get(gca, 'position');
|
||||||
|
set(legend_h, 'position', [loci(1) pos(2) width pos(4)]);
|
||||||
|
col = -1;
|
||||||
|
for i=1:numlines
|
||||||
|
if (mod(i,numpercolumn)==1 || (numpercolumn == 1))
|
||||||
|
col = col+1;
|
||||||
|
end
|
||||||
|
|
||||||
|
if i==1
|
||||||
|
linenum = i+numlines;
|
||||||
|
else
|
||||||
|
if strcmp(type, 'line')
|
||||||
|
linenum = linenum+2;
|
||||||
|
else
|
||||||
|
linenum = linenum+1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
labelnum = i;
|
||||||
|
|
||||||
|
position = mod(i,numpercolumn);
|
||||||
|
if position == 0
|
||||||
|
position = numpercolumn;
|
||||||
|
end
|
||||||
|
|
||||||
|
switch type,
|
||||||
|
case {'line'}
|
||||||
|
%realign the labels
|
||||||
|
set(object_h(linenum), 'ydata', [(height-(position-1)*sheight) (height-(position-1)*sheight)]);
|
||||||
|
set(object_h(linenum), 'xdata', [col/numcolumns+spacer col/numcolumns+spacer+line_width]);
|
||||||
|
|
||||||
|
set(object_h(linenum+1), 'ydata', [height-(position-1)*sheight height-(position-1)*sheight]);
|
||||||
|
set(object_h(linenum+1), 'xdata', [col/numcolumns+spacer*3.5 col/numcolumns+spacer*3.5]);
|
||||||
|
|
||||||
|
set(object_h(labelnum), 'position', [col/numcolumns+spacer*2+line_width height-(position-1)*sheight]);
|
||||||
|
case {'hggroup'},
|
||||||
|
if exist('subtype', 'var')&strcmpi(subtype, 'patch'),
|
||||||
|
child = get(object_h(linenum), 'children');
|
||||||
|
v = get(child, 'vertices');
|
||||||
|
%x-positions
|
||||||
|
v([1:2 5],1) = col/numcolumns+spacer;
|
||||||
|
v(3:4,1) = col/numcolumns+spacer+line_width;
|
||||||
|
% y-positions
|
||||||
|
v([1 4 5],2) = (height-(position-1)*sheight-(position-1)*spacer);
|
||||||
|
v([2 3], 2) = v(1,2)+sheight;
|
||||||
|
set(child, 'vertices', v);
|
||||||
|
set(object_h(labelnum), 'position', [v(3,1)+text_space v(1,2)+(v(2,2)-v(1,2))/2 v(3,1)-v(1,1)]);
|
||||||
|
else
|
||||||
|
child = get(get(object_h(linenum), 'children'), 'children');
|
||||||
|
set(child(2), 'ydata', [(height-(position-1)*sheight) (height-(position-1)*sheight)]);
|
||||||
|
set(child(2), 'xdata', [col/numcolumns+spacer col/numcolumns+spacer+line_width]);
|
||||||
|
|
||||||
|
% set(object_h(linenum+1), 'ydata', [height-(position-1)*sheight height-(position-1)*sheight]);
|
||||||
|
% set(object_h(linenum+1), 'xdata', [col/numcolumns+spacer*3.5 col/numcolumns+spacer*3.5]);
|
||||||
|
|
||||||
|
set(object_h(labelnum), 'position', [col/numcolumns+spacer*2+line_width height-(position-1)*sheight]);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
%unfortunately, it is not possible to force the box to be smaller than the
|
||||||
|
%original height, therefore, turn it off and set background color to none
|
||||||
|
%so that it no longer appears
|
||||||
|
set(legend_h, 'Color', 'None', 'Box', 'off');
|
||||||
|
%let's put it where you want it
|
||||||
|
fig_pos = get(gca, 'position');
|
||||||
|
pos = get(legend_h, 'position');
|
||||||
|
padding = 0.01; % padding, in normalized units
|
||||||
|
% if location is some variation on south, then we need to take into account
|
||||||
|
% the new height
|
||||||
|
if strfind(location, 'south'),
|
||||||
|
h_diff = pos(4)-newheight;
|
||||||
|
pos(4) = newheight;
|
||||||
|
end
|
||||||
|
switch lower(location),
|
||||||
|
case {'northeast'}
|
||||||
|
set(legend_h, 'position', [pos(1)+fig_pos(3)-pos(3)-padding pos(2) pos(3) pos(4)]);
|
||||||
|
case {'northwest'}
|
||||||
|
set(legend_h, 'position', [pos(1)+padding pos(2) pos(3) pos(4)]);
|
||||||
|
case {'southeast'}
|
||||||
|
pos(4) = newheight;
|
||||||
|
set(legend_h, 'position', [pos(1)+fig_pos(3)-pos(3)-padding fig_pos(2)-pos(4)/2+pos(4)/4 pos(3) pos(4)]);
|
||||||
|
case {'southwest'}
|
||||||
|
set(legend_h, 'position', [fig_pos(1)+padding fig_pos(2)-pos(4)/2+pos(4)/4 pos(3) pos(4)]);
|
||||||
|
case {'northeastoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]-[0 0 pos(3) 0]);
|
||||||
|
set(legend_h, 'position', [pos(1)+fig_pos(3)-pos(3) pos(2) pos(3) pos(4)]);
|
||||||
|
case {'northwestoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]+[pos(3) 0 -pos(3) 0]);
|
||||||
|
set(legend_h, 'position', [fig_pos(1)-fig_pos(3)*.1 pos(2) pos(3) pos(4)]); % -10% figurewidth to account for axis labels
|
||||||
|
case {'north'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(legend_h, 'position', [fig_pos(1)+fig_pos(3)/2-pos(3)/2 fig_pos(2)+(fig_pos(4)-pos(4))-padding pos(3) pos(4)]);
|
||||||
|
case {'northoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]-[0 0 0 pos(4)]);
|
||||||
|
% set(legend_h, 'position', [fig_pos(1)+fig_pos(3)/2-pos(3)/2 fig_pos(2)+(fig_pos(4)-pos(4)) pos(3) pos(4)]);
|
||||||
|
set(legend_h, 'position', [fig_pos(1)+fig_pos(3)/2-pos(3)/2 fig_pos(2)+fig_pos(4)-pos(4) pos(3) pos(4)]);
|
||||||
|
case {'south'}
|
||||||
|
y_pos = fig_pos(2)-h_diff+pos(4);
|
||||||
|
set(legend_h, 'position', [fig_pos(1)+fig_pos(3)/2-pos(3)/2 y_pos pos(3) pos(4)]);
|
||||||
|
case {'southoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]-[0 -pos(4) 0 pos(4)]);
|
||||||
|
% set(legend_h, 'position', [fig_pos(1)+fig_pos(3)/2-pos(3)/2 fig_pos(2)-pos(4)-pos(3)*0.1 pos(3) pos(4)]);
|
||||||
|
set(legend_h, 'position', [fig_pos(1)+fig_pos(3)/2-pos(3)/2 0 pos(3) pos(4)]);
|
||||||
|
case {'eastoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]-[0 0 pos(3) 0]);
|
||||||
|
set(legend_h, 'position', [pos(1)+fig_pos(3)-pos(3) fig_pos(2)+fig_pos(4)/2-pos(4)/2 pos(3) pos(4)]);
|
||||||
|
case {'southeastoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]-[0 0 pos(3) 0]);
|
||||||
|
set(legend_h, 'position', [pos(1)+fig_pos(3)-pos(3) fig_pos(2)-pos(4)/4 pos(3) pos(4)]);
|
||||||
|
case {'westoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]+[pos(3) 0 -pos(3) 0]);
|
||||||
|
set(legend_h, 'position', [fig_pos(1)-fig_pos(3)*.1 fig_pos(2)+fig_pos(4)/2-pos(4)/2 pos(3) pos(4)]); % -10% figurewidth to account for axis labels
|
||||||
|
case {'southwestoutside'}
|
||||||
|
% need to resize axes to allow legend to fit in figure window
|
||||||
|
set(gca, 'position', [fig_pos]+[pos(3) 0 -pos(3) 0]);
|
||||||
|
set(legend_h, 'position', [fig_pos(1)-fig_pos(3)*.1 fig_pos(2)-pos(4)/4 pos(3) pos(4)]); % -10% figurewidth to account for axis labels
|
||||||
|
end
|
||||||
|
% display box around legend
|
||||||
|
if boxon
|
||||||
|
drawnow; % make sure everyhting is drawn in place first.
|
||||||
|
% set(legend_h, 'units', 'normalized');
|
||||||
|
pos = get(legend_h, 'position');
|
||||||
|
orgHeight = pos(4);
|
||||||
|
pos(4) = (orgHeight/numlines)*numpercolumn;
|
||||||
|
pos(2)=pos(2) + orgHeight-pos(4) - pos(4)*0.05;
|
||||||
|
pos(1) = pos(1)+pos(1)*0.01;
|
||||||
|
annotation('rectangle',pos, 'linewidth', 1)
|
||||||
|
end
|
||||||
|
% re-set to normalized so that things scale properly
|
||||||
|
set(legend_h, 'units', 'normalized');
|
||||||
|
set(gca, 'units', 'normalized');
|
||||||
|
|
||||||
|
end
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user